Skip to content

Instantly share code, notes, and snippets.

@danlamanna
Created December 11, 2012 15:19
Show Gist options
  • Save danlamanna/4259256 to your computer and use it in GitHub Desktop.
Save danlamanna/4259256 to your computer and use it in GitHub Desktop.
Automating Rackspace email account creation.
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