JSON API » emails » emails/send
Sends bulk emails. The actual sending up is asynchronous, and will happen after the function returns. How the emails are sent depends on the local mail transport agent (MTA) configuration.
Input parameters
Requires authentication and the send emails role privilege.
Name | Type | Description | Required | Default value |
---|---|---|---|---|
auth_username | String | Authentication username. | Yes | |
auth_password | String | Authentication password. | Yes | |
destination | String | Type of destination. See below for details. | Recommended | Empty string. |
emails | String | List of email addresses to send to, separated by spaces and/or commas. | See below | Empty string. |
from | String | From address. | Yes | |
subject | String | Email subject. | Yes | |
body | String | Email body. | Yes | |
customer | Integer | ID of customer to send as. | No | Customer of authentication user. |
The following destination types are defined:
Field value | Send emails to |
---|---|
Empty string or field not set | The addresses in the emails parameter. |
"billing" | The billing contacts of all sub-customers. |
"billing_recursive" | The billing contacts of all sub-customers, recursively. |
"customer" | All people in the sending customer. |
"me" | Just yourself. |
"recursive" | All people in sub-customers, recursively. |
The emails parameter is only used if the destination parameter is an empty string.
Responses
Code | Description |
---|---|
200 | Emails successfully submitted for sending. |
400 | Invalid input parameters specified. Check the key and message fields for more details. |
401 | The authentication details provided are invalid. |
402 | Your role does not allow this. |
403 | Your rate plan does not allow this. |
Data returned
A count of the emails sent.
Example: With required and recommended parameters
http://enswitch.example.com/api/json/emails/send/?auth_username=user;auth_password=password;destination=me;from=from%40example.com;subject=Example%20email;body=This%20is%20an%20example%20email{ "responses":[ { "code":"200", "key":"", "message":"OK" } ], "data":{ "count":1 } }
Example: With emails parameter
http://enswitch.example.com/api/json/emails/send/?auth_username=user;auth_password=password;destination=;emails=destination1%40example.com,destination2%40example.com;from=from%40example.com;subject=Example%20email;body=This%20is%20an%20example%20email{ "responses":[ { "code":"200", "key":"", "message":"OK" } ], "data":{ "count":2 } }
Change history
Version | Changes |
---|---|
3.13 | Function added. |