Skip to main content
POST/emails/send/

Send an email

Email messages using API

From now on you can send email messages using our API. To do so, you'll need to set subject, content and receivers for the message. If you want to send your messages using specific settings, you should specify smtp id, or campaign id, otherwise we will use our default smtp to deliver your messages.

If you want to use content instead of template, just leave only the content attribute in payload. Using both attributes will in turn use template and ignore the content attribute.

HTML is allowed inside of email message content. For example, as a content we can set:

Hi <b>user</b>, enjoy our product!

The email message will be shown as follow:

Hi user, enjoy our product!

AttributesTypeRequiredDescription
authorinteger / stringyesThis can be an email (string) or ID (integer) of an author.
contentstringyesA content of your email message.
receiversintegeryesA list of user ids separated by commas.
smtp/campaignintegernoA unique identifier of your SMTPSettings or Campaign automatically generated by User.com.
subjectstringyesA subject of your email message.
templateintegeryesAn email template unique identifier.

ID for the receivers, can be found by requesting, single user details or by searching his email address.

Author can determine who's the sender of this email, it can be owner or any agent of the app.

Request​

curl -X POST -H "Authorization: Token <your_64_char_api_key>"
-H "Accept: */*; version=2" -H "Content-Type: application/json" -d '{
"subject": "Email sent using API",
"content": "This is content for email sent using API \<a href='\''http://example.org/'\''>link\</a>",
"receivers": "5380718",
"template": 1,
"author": "johndoe@example.org"
}' "https://<your_app_subdomain>.user.com/api/public/emails/send/"

Response​

{
"campaign": 880
}

This response means that the email has been sent correctly.