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.

NameTypeDescriptionRequiredDefault value
auth_usernameStringAuthentication username.Yes
auth_passwordStringAuthentication password.Yes
destinationStringType of destination. See below for details.RecommendedEmpty string.
emailsStringList of email addresses to send to, separated by spaces and/or commas.See belowEmpty string.
fromStringFrom address.Yes
subjectStringEmail subject.Yes
bodyStringEmail body.Yes
customerIntegerID of customer to send as.NoCustomer of authentication user.

The following destination types are defined:

Field valueSend emails to
Empty string or field not setThe 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

CodeDescription
200Emails successfully submitted for sending.
400Invalid input parameters specified. Check the key and message fields for more details.
401The authentication details provided are invalid.
402Your role does not allow this.
403Your 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

VersionChanges
3.13Function added.