# Send a test email
Sends a test email.
Endpoint: POST /previews/rule-actions/send-email
Version: latest
Security: SecretApiKey, JWT
## Request fields (application/json):
- `id` (string)
ID of the message.
- `version` (string)
Version number of the message.
Use this field to distinguish between multiple messages by name and version number.
If there are no versions, this field is empty.
- `weight` (integer)
Weight distribution value that is assigned to a template for a split test.
Each template in a split test can be assigned a weight.
The higher the weight value, the more likely the message template is used.
The split test algorithm does not assess locale when making a weighted template selection.
Example: 75
- `templates` (array, required)
Array of message templates with language locale identifiers in [RFC 5646](https://tools.ietf.org/html/rfc5646) format.
A language is selected based on the customer's locale.
If no locale is configured for the customer, (US English) is used.
If no template is available in the customer's locale,
a template locale is selected using a closest match algorithm.
If your email message templates are localized into more than one language,
set a customer locale.
Invalid placeholders render as empty strings.
For example, is rendered as .
Example: [{"locale":"fr-FR","from":"example@example.com","to":["{{ invoice.customer.email }}"],"subject":"Sujet de démonstration","text":"Texte de démonstration","html":"
Texte de démonstration
","editor":"Texte de démonstration
"}]
- `templates.locale` (string, required)
Language locale identifier in [RFC 5646](https://tools.ietf.org/html/rfc5646) format.
Example: "fr-FR"
- `templates.from` (string, required)
Email address of the sender.
> This value must be a verified email address.
To verify an email address:
1. [Create an email delivery setting](https://www.rebilly.com/catalog/all/email-delivery-settings/postemaildeliverysetting/).
In the response, you receive the email and a token.
1. [Verify the email delivery](https://www.rebilly.com/catalog/all/email-delivery-settings/putemaildeliverysettingsverification/) by passing the token as the path parameter.
Template placeholders are permitted.
If a placeholder does not resolve to a verified address,
the default verified address is used.
Example: "example@example.com"
- `templates.to` (array, required)
List of email addresses to which the email message is sent.
Template placeholders are permitted.
If a placeholder does not resolve to an email address,
the address is not added.
Example: ["{{ invoice.customer.email }}"]
- `templates.cc` (array)
List of CC email addresses to which the email message is sent.
Template placeholders are permitted.
If a placeholder does not resolve to an email address,
the address is not added.
Example: ["{{ invoice.customer.email }}"]
- `templates.bcc` (array)
List of BCC email addresses to which the email message is sent.
Template placeholders are permitted.
If a placeholder does not resolve to an email address,
the address is not added.
Example: ["{{ invoice.customer.email }}"]
- `templates.subject` (string, required)
Subject of the message.
The use of template placeholders is permitted for this field.
Example: "Sujet de démonstration"
- `templates.text` (string, required)
Text body of the message.
To use content from the field, leave this field empty.
The use of template placeholders is permitted for this field.
Example: "Texte de démonstration"
- `templates.html` (string, required)
HTML body of the message.
To use content from the field, leave this field empty.
The use of template placeholders is permitted for this field.
Example: "Texte de démonstration
"
- `templates.editor` (string)
Source of the message.
This value is required for the email editor.
This value is not used for sending emails.
It is used by the editor to reproduce the message for future updates.
Example: "Texte de démonstration
"
- `templates.attachments` (array)
Attachments of the email message.
- `templates.attachments.resourceType` (string, required)
Type of the attachment resource.
Example: "customer"
- `templates.attachments.resourceId` (string, required)
ID of the attachment resource.
Template placeholders are permitted.
Example: "cus_0YV7DDSDD1C8DA64KHH2W33CPF"
## Response 200 fields (application/json):
- `id` (string)
ID of the message.
- `version` (string)
Version number of the message.
Use this field to distinguish between multiple messages by name and version number.
If there are no versions, this field is empty.
- `weight` (integer)
Weight distribution value that is assigned to a template for a split test.
Each template in a split test can be assigned a weight.
The higher the weight value, the more likely the message template is used.
The split test algorithm does not assess locale when making a weighted template selection.
Example: 75
- `templates` (array, required)
Array of message templates with language locale identifiers in [RFC 5646](https://tools.ietf.org/html/rfc5646) format.
A language is selected based on the customer's locale.
If no locale is configured for the customer, (US English) is used.
If no template is available in the customer's locale,
a template locale is selected using a closest match algorithm.
If your email message templates are localized into more than one language,
set a customer locale.
Invalid placeholders render as empty strings.
For example, is rendered as .
Example: [{"locale":"fr-FR","from":"example@example.com","to":["{{ invoice.customer.email }}"],"subject":"Sujet de démonstration","text":"Texte de démonstration","html":"Texte de démonstration
","editor":"Texte de démonstration
"}]
- `templates.locale` (string, required)
Language locale identifier in [RFC 5646](https://tools.ietf.org/html/rfc5646) format.
Example: "fr-FR"
- `templates.from` (string, required)
Email address of the sender.
> This value must be a verified email address.
To verify an email address:
1. [Create an email delivery setting](https://www.rebilly.com/catalog/all/email-delivery-settings/postemaildeliverysetting/).
In the response, you receive the email and a token.
1. [Verify the email delivery](https://www.rebilly.com/catalog/all/email-delivery-settings/putemaildeliverysettingsverification/) by passing the token as the path parameter.
Template placeholders are permitted.
If a placeholder does not resolve to a verified address,
the default verified address is used.
Example: "example@example.com"
- `templates.to` (array, required)
List of email addresses to which the email message is sent.
Template placeholders are permitted.
If a placeholder does not resolve to an email address,
the address is not added.
Example: ["{{ invoice.customer.email }}"]
- `templates.cc` (array)
List of CC email addresses to which the email message is sent.
Template placeholders are permitted.
If a placeholder does not resolve to an email address,
the address is not added.
Example: ["{{ invoice.customer.email }}"]
- `templates.bcc` (array)
List of BCC email addresses to which the email message is sent.
Template placeholders are permitted.
If a placeholder does not resolve to an email address,
the address is not added.
Example: ["{{ invoice.customer.email }}"]
- `templates.subject` (string, required)
Subject of the message.
The use of template placeholders is permitted for this field.
Example: "Sujet de démonstration"
- `templates.text` (string, required)
Text body of the message.
To use content from the field, leave this field empty.
The use of template placeholders is permitted for this field.
Example: "Texte de démonstration"
- `templates.html` (string, required)
HTML body of the message.
To use content from the field, leave this field empty.
The use of template placeholders is permitted for this field.
Example: "Texte de démonstration
"
- `templates.editor` (string)
Source of the message.
This value is required for the email editor.
This value is not used for sending emails.
It is used by the editor to reproduce the message for future updates.
Example: "Texte de démonstration
"
- `templates.attachments` (array)
Attachments of the email message.
- `templates.attachments.resourceType` (string, required)
Type of the attachment resource.
Example: "customer"
- `templates.attachments.resourceId` (string, required)
ID of the attachment resource.
Template placeholders are permitted.
Example: "cus_0YV7DDSDD1C8DA64KHH2W33CPF"
## Response 401 fields (application/json):
- `status` (integer)
HTTP status code.
- `type` (string)
Problem type in the form of a [URI](https://tools.ietf.org/html/rfc3986) reference.
It should provide human-readable documentation for the problem type.
When this member is not present, its value is assumed to be "about:blank".
- `title` (string)
Short, human-readable summary of the problem type.
Other than for the purposes of localization, this should not change from occurrence to occurrence of the problem.
- `detail` (string)
Human-readable explanation that is specific to this occurrence of the problem.
- `instance` (string)
URI reference that identifies the specific occurrence of the problem.
It may or may not yield further information if dereferenced.
## Response 403 fields (application/json):
- `status` (integer)
HTTP status code.
- `type` (string)
Problem type in the form of a [URI](https://tools.ietf.org/html/rfc3986) reference.
It should provide human-readable documentation for the problem type.
When this member is not present, its value is assumed to be "about:blank".
- `title` (string)
Short, human-readable summary of the problem type.
Other than for the purposes of localization, this should not change from occurrence to occurrence of the problem.
- `detail` (string)
Human-readable explanation that is specific to this occurrence of the problem.
- `instance` (string)
URI reference that identifies the specific occurrence of the problem.
It may or may not yield further information if dereferenced.
## Response 422 fields (application/json):
- `status` (integer)
HTTP status code.
- `type` (string)
Problem type in the form of a [URI](https://tools.ietf.org/html/rfc3986) reference.
It should provide human-readable documentation for the problem type.
When this member is not present, its value is assumed to be "about:blank".
- `title` (string)
Short, human-readable summary of the problem type.
Other than for the purposes of localization, this should not change from occurrence to occurrence of the problem.
- `detail` (string)
Human-readable explanation that is specific to this occurrence of the problem.
- `instance` (string)
URI reference that identifies the specific occurrence of the problem.
It may or may not yield further information if dereferenced.
- `invalidFields` (array)
Invalid field details.
Example: [{"field":"field1","message":"field1 is invalid"},{"field":"subObject.field2","message":"field2 is invalid"},{"field":"subObject.field2","message":"another error in the field2"}]
- `invalidFields.field` (string)
Name of the field.
Dot notation is used for nested object field names.
- `invalidFields.message` (string)
Message field.
## Response 429 fields (application/json):
- `type` (string)
Problem type in the form of a [URI](https://tools.ietf.org/html/rfc3986) reference.
It should provide human-readable documentation for the problem type.
When this member is not present, its value is assumed to be "about:blank".
Example: "about:blank"
- `title` (string)
Short, human-readable summary of the problem type.
Other than for the purposes of localization, this should not change from occurrence to occurrence of the problem.
Example: "Rate Limit Exceeded"
- `status` (integer)
HTTP status code.
- `detail` (string)
Human-readable explanation that is specific to this occurrence of the problem.
Example: "A request cannot be executed because the user has sent too many requests within a certain period of time"
- `instance` (string)
URI reference that identifies the specific occurrence of the problem.
It may or may not yield further information if dereferenced.