Create an email message

Request

Creates an email message.

Security
SecretApiKey or JWT
Bodyapplication/jsonrequired

Email message resource.

statusstring

Status of the email message.

Default:"draft"
Enum:"draft""outbox""sent""failed"
metadataobject or null

Metadata associated with the email message.

Example:
{ "eventType": "subscription-canceled" }
credentialHashstring or null

ID of the SMTP or Email Service Provider (ESP) credential.

Example:"b120c2ca-6c2b-4690-9dff-3b0d87852dc7"
fromstring, (email), <= 254 charactersrequired

Email address of the sender.

Example:"from-example@rebilly.com"
toArray of strings, non-emptyrequired

List of email addresses to which the email message is sent.

Example:
[ "to-example@rebilly.com" ]
ccArray of strings

List of CC email addresses to which the email message is sent.

Example:
[ "cc-example@rebilly.com" ]
bccArray of strings

List of BCC email addresses to which the email message is sent.

Example:
[ "cc-example@rebilly.com" ]
subjectstring, <= 998 charactersrequired

Subject of the email message.

Example:"Welcome dear customer!"
textstringrequired

Body of the email message in plain text.

Example:"Email message text body"
htmlstringrequired

Body of the email message in HTML format.

Example:"<p>Email message html body</p>"
attachmentsArray of objects

Attachments of the email message.

curl -i -X POST \
  https://www.rebilly.com/_mock/catalog/all/email-messages \
  -H 'Content-Type: application/json' \
  -H 'REB-APIKEY: YOUR_API_KEY_HERE' \
  -d '{
    "status": "draft",
    "metadata": {
      "eventType": "subscription-canceled"
    },
    "credentialHash": "b120c2ca-6c2b-4690-9dff-3b0d87852dc7",
    "from": "from-example@rebilly.com",
    "to": [
      "to-example@rebilly.com"
    ],
    "cc": [
      "cc-example@rebilly.com"
    ],
    "bcc": [
      "cc-example@rebilly.com"
    ],
    "subject": "Welcome dear customer!",
    "text": "Email message text body",
    "html": "<p>Email message html body</p>",
    "attachments": [
      {
        "resourceType": "invoice",
        "resourceId": "att_0YV7J787J0DW0918MQQMDHWA7M"
      }
    ]
  }'

Responses

Email message created.

Headers
Locationstring, (uri)

Location of the related resource.

Example:"https://api.rebilly.com/example"
X-RateLimit-Limitinteger

Total number of rate limit tokens for this request within a rate limit period. For more information, see Rate limits.

Example:3600
X-RateLimit-Remaininginteger

Remaining number of rate limit tokens for this request within the rate limit period. For example, in the sandbox environment, rate limits for non-GET endpoints are set at 3000 requests per 10 minutes.

Example:3600
Bodyapplication/json
idstring, <= 50 charactersread-only

ID of the email message.

Example:"mail_msg_0YVCNR8ZRBCVMAX28DP4XRFZVA"
statusstring

Status of the email message.

Default:"draft"
Enum:"draft""outbox""sent""failed"
metadataobject or null

Metadata associated with the email message.

Example:
{ "eventType": "subscription-canceled" }
credentialHashstring or null

ID of the SMTP or Email Service Provider (ESP) credential.

Example:"b120c2ca-6c2b-4690-9dff-3b0d87852dc7"
fromstring, (email), <= 254 charactersrequired

Email address of the sender.

Example:"from-example@rebilly.com"
toArray of strings, non-emptyrequired

List of email addresses to which the email message is sent.

Example:
[ "to-example@rebilly.com" ]
ccArray of strings

List of CC email addresses to which the email message is sent.

Example:
[ "cc-example@rebilly.com" ]
bccArray of strings

List of BCC email addresses to which the email message is sent.

Example:
[ "cc-example@rebilly.com" ]
subjectstring, <= 998 charactersrequired

Subject of the email message.

Example:"Welcome dear customer!"
textstringrequired

Body of the email message in plain text.

Example:"Email message text body"
htmlstringrequired

Body of the email message in HTML format.

Example:"<p>Email message html body</p>"
attachmentsArray of objects

Attachments of the email message.

responseCodeinteger or nullread-only

Status code returned by a mail service after an attempt to send email.

Example:250
responseBodystring or nullread-only

Body of response returned by a mail service after an attempt to send email.

initiatedTimestring or null, (date-time)read-only

Date and time when the email is initiated.

sentTimestring or null, (date-time)read-only

Date and time when the email is sent.

createdTimestring, (date-time)(CreatedTime)read-only

Date and time when the resource is created. This value is set automatically when the resource is created.

updatedTimestring, (date-time)(UpdatedTime)read-only

Date and time when the resource is updated. This value is set automatically when the resource is updated.

Response
{ "id": "mail_msg_0YVCNR8ZRBCVMAX28DP4XRFZVA", "status": "draft", "metadata": { "eventType": "subscription-canceled" }, "credentialHash": "b120c2ca-6c2b-4690-9dff-3b0d87852dc7", "from": "from-example@rebilly.com", "to": [ "to-example@rebilly.com" ], "cc": [ "cc-example@rebilly.com" ], "bcc": [ "cc-example@rebilly.com" ], "subject": "Welcome dear customer!", "text": "Email message text body", "html": "<p>Email message html body</p>", "attachments": [ {} ], "responseCode": 250, "responseBody": "string", "initiatedTime": "2019-08-24T14:15:22Z", "sentTime": "2019-08-24T14:15:22Z", "createdTime": "2019-08-24T14:15:22Z", "updatedTime": "2019-08-24T14:15:22Z", "_links": [ {} ] }