Send an Email

Through Email API, you may send email to multiple contacts, schedule emails and track analytics of such emails. You may use any of the following email content parameters while executing email campaigns:

  • Text - plain text content to be sent
  • Html - full html content to be sent
  • Template – pre-defined templated to be used

Send Simple Text Email

curl -X POST \
'<BASE_URL>&method=email&format=xml&subject=testingemails&to[0][email]=<emailID>&to[0][name]=ABC&from[email]=<emailID>&text=Hi how are you today&from[name]=XYZ'

API Parameter Specifications

The API parameter specifications are described in the following sections.

Mandatory Parameters

The mandatory parameters in the HTTP API are tabulated below:

Parameter Value Description
URL URL URL of Alerts service
api_key Alphanumeric characters (API key) Authentication key shared with you from SI
method Email or List email to send an email to single or multiple recipient. list to send an email to everyone in your contact group
text body of email Plain text message to be displayed in email
subject Subject of email Subject to be displayed to recipient in email
From[email] Sender email ID From which email ID you want to send email
To[0][email] Recipient email ID; Can also be used for multiple email IDs in sequence like To[1][email], To[2][email], etc To which email ID(s) you want to send email(s)

Optional Parameters

The optional parameters in the HTTP API are tabulated below:

Parameter Value Description
To[0][name] Name of recipient to be shown in email; Can also be used for multiple recipients associated with email IDs like To[1][name], to[2][name],etc To whom you want to send email(s); Recipient name(s)
From[name] Who has sent this email(s) i.e. Sender Name to be shown in email Sender name so that recipients must know that you have sent email(s)
format XML/PHP/JSON/JSONP. In which format you want to see the response. Default response will be in JSON
time YYYY-MM-DD HH:MM:SS OR YYYY-MM-DD HH:MM AM/PM Date and time need to be mentioned; when you want to schedule an email.
name Campaign name You may give any name to this email campaign

Example Responses

  1. JSON
{ "status": "OK",
  "data": {
    "0": {
      "id": "1878054-1",
      "email": "xyz@gmail.com",
      "name": ABC,
      "status": "AWAITED-DLR"
    },
    "group_id": 1878054
  },
  "message": "Campaign of 1 emails Submitted successfully."}
  1. XML
<api>
    <status>OK</status>
    <data>
        <group_id>1878063</group_id>
        <email>
            <id>1878063-1</id>
            <email>xyz@gmail.com</email>
            <name>abc</name>
            <status>AWAITED-DLR</status>
        </email>
    </data>
    <message>Campaign of 1 emails Submitted successfully.</message>
</api>
  • If you have put so many email IDs in a single parameter, then system will pick the last email ID. For eg. To[0][email]= recipient_one@example.com , To[0][email]= recipient_two@example.com To[0][email]= recipient_three@example.com To[0][email]= recipient_four@example.com, then in this case, system will send an email to recipient_four@example.com.
  • We need to put email IDs in the following format & sequence only: To[0][email]= recipient_one@example.com , To[1][email]= recipient_two@example.com To[2][email]= recipient_three@example.com To[3][email]= recipient_four@example.com
  • Parameters will be be mapped in the following way while sending emails: To[0][email]= recipient_one@example.com & to[0][name]=Recipient One To[1][email]= recipient_two@example.com & to[1][name]=Recipient Two

Send An Email With Attachment

While sending email through the following format, you may also attach files upto 10Mb in either of the formats like xls, pdf, doc, png, jpeg, etc.

curl -X POST \
'<BASE_URL>&method=email&format=xml&subject=testingemails&to[0][email]=<emailID>&to[0][name]=ABC&from[email]=<emailID>&text=Hi how are you today&from[name]=XYZ&files[]=sdfrt12.png'

Mandatory Parameters

The mandatory parameters in the HTTP API are tabulated below:

Parameter Value Description
URL URL URL of Alerts service
api_key Alphanumeric characters (API key) Authentication key shared with you from SI
method Email To send an email to single and multiple recipients as well
text body of email Plain text message to be displayed in email
subject Subject of email Subject to be displayed to recipient in email
From[email] Sender email ID From which email ID you want to send email
To[0][email] Recipient email ID; Can also be used for multiple email IDs in sequence like To[1][email], To[2][email], etc To which email ID(s) you want to send email(s)

Optional Parameters

The optional parameters in the HTTP API are tabulated below:

Parameter Value Description
Files[] Attachment Attach any file to be sent to recipients; Recipients will receive emails along with the attachments upto 10Mb
To[0][name] Name of recipient to be shown in email; Can also be used for multiple recipients associated with email IDs like To[1][name], to[2][name],etc To whom you want to send email(s); Recipient name(s)
From[name] Who has sent this email(s) i.e. Sender Name to be shown in email Sender name so that recipients must know that you have sent email(s)
format XML/PHP/JSON/JSONP. In which format you want to see the response. Default response will be in JSON
time YYYY-MM-DD HH:MM:SS OR YYYY-MM-DD HH:MM AM/PM Date and time need to be mentioned; when you want to schedule an email.
name Campaign name You may give any name to this email campaign

Send an Email using Template

Here is an API format to send email using the pre-defined templates created using “Template” feature under Emailer menu. If you use any specific templates, then you may skip Text or HTML parameter i.e. Body of an email as system will pick the template content for body of an email.

curl -X POST \
'<BASE_URL>&method=email&format=xml&subject=testingemails&to[0][email]=<emailID>&to[0][name]=ABC&from[email]=<emailID&from[name]=XYZ&files[]=sdfrt12.png&template[id]=30'

Mandatory Parameters

The mandatory parameters in the HTTP API are tabulated below:

Parameter Value Description
URL URL URL of Alerts service
api_key Alphanumeric characters (API key) Authentication key shared with you from SI
method Email To send an email to single and multiple recipients as well
subject Subject of email Subject to be displayed to recipient in email
From[email] Sender email ID From which email ID you want to send email
To[0][email] Recipient email ID; Can also be used for multiple email IDs in sequence like To[1][email], To[2][email], etc To which email ID(s) you want to send email(s)

Optional Parameters

The optional parameters in the HTTP API are tabulated below:

Parameter Value Description
Template[id] Template ID (numeric value) for specific template Use this template ID for pre-defined templates created in the application; template will be applied to outgoing email campaign
Files[] Attachment upto 10Mb Attach any file to be sent to recipients; Recipients will receive emails along with the attachments upto 10Mb
To[0][name] Name of recipient to be shown in email; Can also be used for multiple recipients associated with email IDs like To[1][name], to[2][name],etc To whom you want to send email(s); Recipient name(s)
From[name] Who has sent this email(s) i.e. Sender Name to be shown in email Sender name so that recipients must know that you have sent email(s)
format XML/PHP/JSON/JSONP. In which format you want to see the response. Default response will be in JSON
time YYYY-MM-DD HH:MM:SS OR YYYY-MM-DD HH:MM AM/PM Date and time need to be mentioned; when you want to schedule an email.
name Campaign name You may give any name to this email campaign

Send an HTML email

You can apply CSS styles to such HTML content based emails and your outgoing mail will adopt these styles across all recipients.

curl -X POST \
'<BASE_URL>&method=email&format=xml&subject=testingemails&to[0][email]=<emailID>&to[0][name]=ABC&from[email]=<emailID> &from[name]=XYZ&files[]=sdfrt12.png&template[id]=30&html= <div class="form-group"> <label for="password">Password</label> <input type="password" name="password" class="form-control" required="required" placeholder="Enter your password" autocomplete="off" /> <a href="http://alerts.sinfini.com/members/resetpass" id="forgot-password">Forgot?</a> </div>'

Mandatory Parameters

The mandatory parameters in the HTTP API are tabulated below:

Parameter Value Description
URL URL URL of Alerts service
api_key Alphanumeric characters (API key) Authentication key shared with you from SI
method Email To send an email to single and multiple recipients as well
Html (Mandatory for customized emails) Html tags needs to be used for designing emails To include design elements in email content via HTML tags
subject Subject of email Subject to be displayed to recipient in email
From[email] Sender email ID From which email ID you want to send email
To[0][email] Recipient email ID; Can also be used for multiple email IDs in sequence like To[1][email], To[2][email], etc To which email ID(s) you want to send email(s)

Optional Parameters

The optional parameters in the HTTP API are tabulated below:

Parameter Value Description
Template[id] or Template Template ID (numeric value) for specific template Use this template ID for pre-defined templates created in the application; template will be applied to outgoing email campaign
Files[] Attachment upto 10Mb Attach any file to be sent to recipients; Recipients will receive emails along with the attachments upto 10Mb
To[0][name] Name of recipient to be shown in email; Can also be used for multiple recipients associated with email IDs like To[1][name], to[2][name],etc To whom you want to send email(s); Recipient name(s)
From[name] Who has sent this email(s) i.e. Sender Name to be shown in email Sender name so that recipients must know that you have sent email(s)
format XML/PHP/JSON/JSONP. In which format you want to see the response. Default response will be in JSON
time YYYY-MM-DD HH:MM:SS OR YYYY-MM-DD HH:MM AM/PM Date and time need to be mentioned; when you want to schedule an email.
name Campaign name You may give any name to this email campaign

Expected API Error Codes

STATUS MESSAGE
E601 Missing recipient
E602 Invalid Template
E603 Missing message
E604 Invalid schedule time. Minimum 5minutes time gap is required.
E606 Unable to find gateway to send email
E607 No valid email address found
E609 Unable to write to temp files
E610 Unable to process your request. try again
E599 Missing From address
A401B Method not found
E600 Missing Subject
A402 API key not found