Created
December 11, 2012 15:19
-
-
Save danlamanna/4259256 to your computer and use it in GitHub Desktop.
Automating Rackspace email account creation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static function _setupRackspace($name, $domain, array $emails=array()) { | |
$rs = new ApiServer(); | |
// Use existing customer, or create them as new | |
if (!($customer = self::_customerExists($name))) { | |
$customer = (object)json_decode($rs->post('/customers', array('name' => $name), 'application/json')); | |
} | |
// Add domain w/ mailboxes | |
$rs->post(sprintf('/customers/%d/domains/%s', $customer->accountNumber, $domain), | |
array('serviceType' => 'rsemail', | |
'rsEmailMaxNumberMailboxes' => 5, | |
'rsEmailBaseMailboxSize' => '1024')); | |
foreach ($emails as $email) { | |
$rs->post(sprintf('/customers/%d/domains/%s/rs/mailboxes/%s', $customer->accountNumber, $domain, $email), | |
array('password' => 'testing', | |
'size' => '1024')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment