Send email
Send a email with our API
curl https://api.acymailer.com/api/send \
-X POST \
-H 'Content-Type: application/json' \
-H 'API-KEY: your-license-key' \
-H 'Version: external' \
-d '{"email":"Date: Thu, 7 Mar 2024 12:15:03 +0100\r\nFrom: Email example <[email protected]>\r\nCc: [email protected]\r\nReply-To: Email no-reply <[email protected]>\r\nMessage-ID: <fFkkPmogsPGI9joSa6txvJno0DBX20VhMQgu6Hk6Q@rleclercq-A027-I00000>\r\nX-Mailer: PHPMailer 6.9.1 (https:\/\/github.com\/PHPMailer\/PHPMailer)\r\nMIME-Version: 1.0\r\nContent-Type: multipart\/alternative;\r\n boundary=\"b1=_fFkkPmogsPGI9joSa6txvJno0DBX20VhMQgu6Hk6Q\"\r\nContent-Transfer-Encoding: 8bit\r\nTo: [email protected]\r\nSubject: This is the subject\r\n\r\n--b1=_fFkkPmogsPGI9joSa6txvJno0DBX20VhMQgu6Hk6Q\r\nContent-Type: text\/plain; charset=us-ascii\r\n\r\nThis is the alternative body. Only text here\r\n\r\n--b1=_fFkkPmogsPGI9joSa6txvJno0DBX20VhMQgu6Hk6Q\r\nContent-Type: text\/html; charset=us-ascii\r\n\r\nThis is the body with a <h1>title<\/h1> and a <a href=\"https:\/\/www.acymailing.com\">link<\/a>.\r\n\r\n\r\n--b1=_fFkkPmogsPGI9joSa6txvJno0DBX20VhMQgu6Hk6Q--\r\n","domainsUsed":["example.com"]}'<?php
$acymailer = new AcyMailer\SendingService('your-license-key');
$optionsSendEmail = [
'to' => '[email protected]',
'subject' => 'This is the subject',
'body' => 'This is the body with a <h1>title</h1> and a <a href="https://www.acymailing.com">link</a>.',
'alt_body' => 'This is the alternative body. Only text here', // optionnal
'from_email' => '[email protected]',
'from_name' => 'Email example',
'reply_to_email' => '[email protected]', // optional, default to from_email
'reply_to_name' => 'Email no-reply', // optional, default to from_name
'bounce_email' => '[email protected]', // optional, default to from_email
'cc' => ['[email protected]'], // optional, must be an array
'attachments' => ['/path/to/attachment.png'], // optional, must be an array
];
$response = $acymailer->send($optionsSendEmail);POST /api/send
Send an email with the API
Headers
Content-Type
application/json
API-KEY
<license-key>
Version
Must be "external"
Body
{
"email":"Date: Thu, 7 Mar 2024 12:15:03 +0100\r\nFrom: Email example <[email protected]>\r\nCc: [email protected]\r\nReply-To: Email no-reply <[email protected]>\r\nMessage-ID: <fFkkPmogsPGI9joSa6txvJno0DBX20VhMQgu6Hk6Q@rleclercq-A027-I00000>\r\nX-Mailer: PHPMailer 6.9.1 (https:\/\/github.com\/PHPMailer\/PHPMailer)\r\nMIME-Version: 1.0\r\nContent-Type: multipart\/alternative;\r\n boundary=\"b1=_fFkkPmogsPGI9joSa6txvJno0DBX20VhMQgu6Hk6Q\"\r\nContent-Transfer-Encoding: 8bit\r\nTo: [email protected]\r\nSubject: This is the subject\r\n\r\n--b1=_fFkkPmogsPGI9joSa6txvJno0DBX20VhMQgu6Hk6Q\r\nContent-Type: text\/plain; charset=us-ascii\r\n\r\nThis is the alternative body. Only text here\r\n\r\n--b1=_fFkkPmogsPGI9joSa6txvJno0DBX20VhMQgu6Hk6Q\r\nContent-Type: text\/html; charset=us-ascii\r\n\r\nThis is the body with a <h1>title<\/h1> and a <a href=\"https:\/\/www.acymailing.com\">link<\/a>.\r\n\r\n\r\n--b1=_fFkkPmogsPGI9joSa6txvJno0DBX20VhMQgu6Hk6Q--\r\n",
"domainsUsed":["example.com"],
"isTransactional": false
}email must be your email in a MIME format
domainUsed must be an array of all domains used in the email for the the 3 email addresses: - From email - Bounce email - Reply-to email
isTransactional must be either true or false
For example:
Same domain but different email addresses:
- From: [email protected]
- Reply-to: [email protected]
- Bounce: [email protected]
The value should be ["your-domain.com"]
Different domain and different email addresses:
- From: [email protected]
- Reply-to: [email protected]
- Bounce: [email protected]
The value should be ["example.com", "your-other-domain.com"]
Response
Last updated