curl -X POST https://api2.ecomailapp.cz/transactional/send-message \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"message": {
"subject": "Email subject",
"from_name": "Sender'\''s name",
"from_email": "foo@bar.cz",
"reply_to": "foo@bar.cz",
"text": "Plain text content",
"html": "<b>Email HTML content</b>",
"to": [
{
"email": "to@me.com",
"name": "Recipient'\''s name",
"cc": "cc@me.com",
"bcc": "bcc@me.com"
}
],
"global_merge_vars": [
{"name": "mergeTagName", "content": "mergeTagValue"}
],
"attachments": [
{
"type": "mime/type",
"name": "attachment-name.pdf",
"content": "base64encodedcontent"
}
],
"options": {
"click_tracking": true,
"open_tracking": true
}
}
}'
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/transactional/send-message');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'message' => [
'subject' => 'Email subject',
'from_name' => "Sender's name",
'from_email' => 'foo@bar.cz',
'reply_to' => 'foo@bar.cz',
'text' => 'Plain text content',
'html' => '<b>Email HTML content</b>',
'to' => [
[
'email' => 'to@me.com',
'name' => "Recipient's name",
'cc' => 'cc@me.com',
'bcc' => 'bcc@me.com',
],
],
'global_merge_vars' => [
['name' => 'mergeTagName', 'content' => 'mergeTagValue'],
],
'attachments' => [
[
'type' => 'mime/type',
'name' => 'attachment-name.pdf',
'content' => 'base64encodedcontent',
],
],
'options' => [
'click_tracking' => true,
'open_tracking' => true,
],
],
]));
$response = curl_exec($ch);
curl_close($ch);
{
"results": {
"total_rejected_recipients": 0,
"total_accepted_recipients": 2,
"id": 11668787484950529
}
}
Transactional emails
Send transactional email
Send a transactional email with custom content.
POST
/
transactional
/
send-message
curl -X POST https://api2.ecomailapp.cz/transactional/send-message \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"message": {
"subject": "Email subject",
"from_name": "Sender'\''s name",
"from_email": "foo@bar.cz",
"reply_to": "foo@bar.cz",
"text": "Plain text content",
"html": "<b>Email HTML content</b>",
"to": [
{
"email": "to@me.com",
"name": "Recipient'\''s name",
"cc": "cc@me.com",
"bcc": "bcc@me.com"
}
],
"global_merge_vars": [
{"name": "mergeTagName", "content": "mergeTagValue"}
],
"attachments": [
{
"type": "mime/type",
"name": "attachment-name.pdf",
"content": "base64encodedcontent"
}
],
"options": {
"click_tracking": true,
"open_tracking": true
}
}
}'
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/transactional/send-message');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'message' => [
'subject' => 'Email subject',
'from_name' => "Sender's name",
'from_email' => 'foo@bar.cz',
'reply_to' => 'foo@bar.cz',
'text' => 'Plain text content',
'html' => '<b>Email HTML content</b>',
'to' => [
[
'email' => 'to@me.com',
'name' => "Recipient's name",
'cc' => 'cc@me.com',
'bcc' => 'bcc@me.com',
],
],
'global_merge_vars' => [
['name' => 'mergeTagName', 'content' => 'mergeTagValue'],
],
'attachments' => [
[
'type' => 'mime/type',
'name' => 'attachment-name.pdf',
'content' => 'base64encodedcontent',
],
],
'options' => [
'click_tracking' => true,
'open_tracking' => true,
],
],
]));
$response = curl_exec($ch);
curl_close($ch);
{
"results": {
"total_rejected_recipients": 0,
"total_accepted_recipients": 2,
"id": 11668787484950529
}
}
Transactional emails are only available for paid accounts with a verified sending domain.
The total data limit for sent merge tags is 100,000 bytes. Message size including attachments must be under 4 MB.
Reserved variables that cannot be used as merge tag names:
address.name, email, email_id, address.email, env_from.When using HTML code in global merge vars, use curly braces around the tag in HTML content:
{*|htmlcode|*} renders the HTML, while *|htmlcode|* shows raw HTML.To send to multiple CC/BCC recipients, include multiple objects in the
to array with the same email but different cc/bcc values.The message object containing all email details.
Show message properties
Show message properties
Email subject line.
Sender’s display name.
Sender’s email address. Must be from a verified domain.
Reply-to email address.
Plain text content. Either
text or html is required.HTML content. Either
text or html is required.AMP HTML content.
curl -X POST https://api2.ecomailapp.cz/transactional/send-message \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"message": {
"subject": "Email subject",
"from_name": "Sender'\''s name",
"from_email": "foo@bar.cz",
"reply_to": "foo@bar.cz",
"text": "Plain text content",
"html": "<b>Email HTML content</b>",
"to": [
{
"email": "to@me.com",
"name": "Recipient'\''s name",
"cc": "cc@me.com",
"bcc": "bcc@me.com"
}
],
"global_merge_vars": [
{"name": "mergeTagName", "content": "mergeTagValue"}
],
"attachments": [
{
"type": "mime/type",
"name": "attachment-name.pdf",
"content": "base64encodedcontent"
}
],
"options": {
"click_tracking": true,
"open_tracking": true
}
}
}'
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/transactional/send-message');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'message' => [
'subject' => 'Email subject',
'from_name' => "Sender's name",
'from_email' => 'foo@bar.cz',
'reply_to' => 'foo@bar.cz',
'text' => 'Plain text content',
'html' => '<b>Email HTML content</b>',
'to' => [
[
'email' => 'to@me.com',
'name' => "Recipient's name",
'cc' => 'cc@me.com',
'bcc' => 'bcc@me.com',
],
],
'global_merge_vars' => [
['name' => 'mergeTagName', 'content' => 'mergeTagValue'],
],
'attachments' => [
[
'type' => 'mime/type',
'name' => 'attachment-name.pdf',
'content' => 'base64encodedcontent',
],
],
'options' => [
'click_tracking' => true,
'open_tracking' => true,
],
],
]));
$response = curl_exec($ch);
curl_close($ch);
{
"results": {
"total_rejected_recipients": 0,
"total_accepted_recipients": 2,
"id": 11668787484950529
}
}
⌘I