This method will associate email with your Email SMS account. Possible results are:



EMAIL_OK email was successfully associated with your account
EMAIL_FIELDS_EMPTY the email was not provided
EMAIL_FIELDS_INVALID email or other fields are in invalid format. see below for possible parameters data
EMAIL_EXISTS the email you provided is already registered with our service
EMAIL_DOMAIN_EXISTS you are attempting to register wildcard email but another email with this domain already exists
EMAIL_WILDCARD_EXISTS this wildcard email already exists

Parameters:



  • email - string - the email you want to use.

  • messages_limit - int - max quantity of SMS per one email. could be

    • 1 - max 160 characters

    • 2 - max 306 characters

    • 3 - max 459 characters

    • 4 - max 612 character


    the default value is 1;

  • international - boolean - is the number you provide as an address in international format (true) or local (false). the default is false.

  • send_dlr - boolean - do you want to receive email notifications on all SMS deliveries (true) or failed only (false). the default is false.

  • longcode - integer - your own number (if you purchased one on BurstSMS earlier) to send SMS from.


 




 




XML Request Example


<?xml version='1.0'?>

<request>
<interface>PHP</interface>
<version>0.4</version>
<key>API_KEY</key>
<secret>API_SECRET</secret>
<method>emails.add</method>
<params>
<email>user@example.com</email>
<messages_limit>2</messages_limit>
<international />
<send_dlr>true</send_dlr>
<longcode>0</longcode>
</params>
</request>







XML Response Example


<?xml version='1.0'?>

<xml>
<method>emails.add</method>
<total>1</total>
<time>2012-04-09 13:40:03 GMT</time>
<timestamp>1333978803 GMT</timestamp>
<response>EMAIL_OK</response>
</xml>







PHP Example


Download the PHP API Client


<?php


// change api key and secret to your own
$myAPIKey = "API_KEY";
$myAPISecret = "API_SECRET";

// include base class
require('APIclient.php');

// create new client object
$transmitsmsAPI = new transmitsmsAPI($myAPIKey, $myAPISecret);

// set parameters
$email='user@example.com';
$messages_limit = 2;
$international=false;
$number=0;
send_dlr=1;

// execute request
$methodResponse = $transmitsmsAPI->addEmail($email, $messages_limit, $international, $number, send_dlr);

// parse response into xml object
$xml = @simplexml_load_string($methodResponse);

echo ((string) $xml->response == 'EMAIL_OK') ? "Email was registered" : "Error registering email: " . (string) $xml->response;

?>






GET Example


Using a URL based request system you can request this method by using the below URL - be sure to url encode all your variables!


http://burst.transmitsms.com/api-wrapper/emails.add?apikey=API_KEY&apisecret=API_SECRET&email=EMAIL&messages_limit=MESSAGES_LIMIT&international=IS_INTERNATIONAL&longcode=NUMBER&send_dlr=SEND_DLR