Send test email
Send a test email to up to 5 recipients. Recipients are always given as an array, and an optional host name sets the domain used in unsubscribe links.
ReferenceView as Markdown
Send a test email through Subrite.
- Method:
POST - Route:
{baseUrl}/api/v1/communications/email/test - Authorization: Bearer token (use the M2M token from Setup)
- Body: see the example below
Example body#
{
"communicationType": "marketing", // Possible values: "marketing" or "information"
"name": "coming from external",
"senderId": 2, // Use sender ID from Step 2 response
"consentId": null,
"segmentId": 1, // Use segment ID from Step 3 response
"subject": "email subject",
"emailPreviewText": "sample",
"templateId": 1, // Optional
"emailContent": "<div>hello world</div>",
"recipients": ["user@example.com", "user@example2.com"], // Always use an array for recipients, even when sending to a single address. Maximum 5 recipients allowed per test email.
"hostName": "example.com" // Optional. See "Host name" below.
}In the example, the senderId comes from the step 2 response and the segmentId from the step 3 response on the Setup page.
Host name#
hostName is optional. When set, unsubscribe links generated for this email use the supplied hostname instead of the tenant's primary hostname. Use it when your tenant serves multiple brand domains so recipients land on the correct brand.
- Must match the tenant's primary hostname or one of its registered additional hostnames. Foreign or unregistered hostnames are silently ignored and the tenant's primary hostname is used as a fallback.
- DNS-safe characters only (
a-z,0-9,.,-, optional:port); IDN hostnames must be supplied in punycode form. - Omit the field to use the tenant's primary hostname.
Success response#
{
success: true,
message: 'Test emails sent successfully',
id: 12212
}