Skip to main content
POST/emails/send-custom-domain/

Send email messages with custom domain

This endpoint allows you to send email messages using your custom domain settings. You need a custom domain settings ID (which you can get from Email settings) and optionally a custom sender ID (from Sender settings).

HTML is allowed within email message content. For example, you can set the content as:

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

The email message will be displayed as:

Hi user, enjoy our product!

Attribute

Optional unless marked required

api_email_settings/campaigninteger
The unique identifier of your custom domain settings or campaign automatically generated by User.
authorinteger / stringrequired
The unique identifier of an email author (string) or author ID (integer).
contentstringrequired
The content of your email message (HTML allowed).
custom_senderinteger
The unique identifier of your custom sender (optional).
receiversstringrequired
A comma-separated list of user IDs.
subjectstringrequired
The subject line for your email message.
templateinteger
The unique identifier of the email template.

If you want to use an existing email campaign, pass your email campaign ID as the value in the request body. Note that your email campaign must be active.

The author parameter determines who appears as the sender of this email - it can be the owner or any agent of the app.

Request​

curl -X POST "https://<your_app_subdomain>.user.com/api/public/emails/send-custom-domain/" \
-H "Authorization: Token <your_64_char_api_key>" \
-H "Accept: */*; version=2" \
-H "Content-Type: application/json" \
-d '{
"author": 2,
"receivers": 12345,
"subject": "Your weekly summary",
"content": "<p>Here is what happened in your account this week.</p>",
"template": 165
}'

Response examples​

{
"campaign": 880
}

This response indicates that the email has been sent successfully. The returned value is the email campaign ID that was created for this send operation.

Response fields​

Fields returned in the 201 Created response body.

campaigninteger
ID of the campaign the email belongs to.
note

Errors that can come from any endpoint (401, 429, 500, 502, 504) are described in HTTP response codes.