Send Email
The Send Email method allows you to send emails to any contact and manually select the domain from which to send them.
Request
IMPORTANT: Do not send more than 10 concurrent API requests.
Body Example
{
"from": {
"email": "user@senderexample.com",
"name": "Sender Name"
},
"to": {
"email": "user@recipientexample.com",
"name": "Contact Name"
},
"replyTo": {
"email": "support@senderexample.com",
"name": "Support"
},
"subject": "Hello subject",
"html": "Hello, World!",
"text": "Hello, World!",
"ignoreBlackList": false,
"tags": [ "mailerApiSend" ],
"headers": { "X-Additional-Header": "additional-header-value" },
"priority": 1
}
Parameters
Title | Type | Default | Description |
---|---|---|---|
from required
|
object |
An array of sender information. |
|
from.email required
|
string |
The sender email address. |
|
from.name optional
|
string | from.email |
Optional from name to be used. |
to required
|
object |
An array of recipient information. |
|
to.email required
|
string |
The email address of the recipient. |
|
to.name optional
|
string | to.email |
The optional display name to use for the recipient. |
replyTo optional
|
object | null |
An array of optional reply-to information. |
replyTo.email required
|
string |
The email address of the reply-to recipient. |
|
replyTo.name optional
|
string | replyTo.email |
The optional display name to use for the reply-to recipient. |
subject required
|
string |
The message subject. |
|
html required
|
string |
The full HTML or text content to be sent. |
|
text optional
|
string | html |
Optional plain text content to be sent. If no text version of the email is provided, Wooxy will generate it from the HTML copy. |
ignoreBlackList optional
|
boolean | false |
By setting the filter to true, your message will bypass all unsubscribes and suppressions in all lists.
|
tags optional
|
array | null |
An array of string to tag the message with. Stats are accumulated using tags, though we only store the first 100 we see, so this should not be unique or change frequently. Tags should be 50 characters or less. |
headers optional
|
object | null |
Optional extra headers to add to the message (most headers are allowed). |
priority optional
|
integer | 1 |
Add priority parameter to the outgoing emails to avoid delivery delays for important messages due to large promo campaigns in queue.
|
Response
{
"result": true,
"messageId": "5d914c3dd132d5f45a4e3670"
}
Parameters
Title | Type | Description |
---|---|---|
messageId |
string |
The message's unique identification number is in the Wooxy system. This ID number allows you to get all the statistics for each message you send. |
result |
boolean |
The sending status of the recipient:
|
Method Errors
{
"result": false,
"errors": [
"Error description text"
]
}
Error |
---|
“Maximum count of records per transaction is 100, current {n}” |
“from field must contain email and name fields” |
“email parameter at from field required” |
“Invalid RFC2822 email {email}” |
“name parameter at from field must be a string” |
“to field must contain email and name fields” |
“email parameter at to field required” |
“Invalid RFC2822 email {email}” |
“name parameter at to field must be a string” |
“replyTo field must contain email and name fields” |
“email parameter at replyTo field required” |
“Invalid RFC2822 email {email}” |
“name parameter at replyTo field must be a string” |
“Argument subject must be a non-empty string” |
“Argument html must be a non-empty string” |
“Argument text must be a string” |
“Argument tags must be an array” |
“tag name must be a non-empty string” |
“Tags should be 50 characters or less” |
“Any tags starting with an underscore are reserved for internal use and will cause errors” |
“Argument headers must be an array with header-names as keys and header-values as values” |
“header name must be a non-empty string” |
“header value must be a non-empty string” |
“Argument priority must be an integer” |
“Argument priority must be between 1 and 5” |
Code Examples
$accessToken = "YOUR_API_KEY";
$url = 'https://api.wooxy.com/v3/mailer/send';
$body = json_encode([
'from' => [
'email' => 'user@senderexample.com',
'name' => 'Sender name',
],
'to' => [
'email' => 'user@recipientexample.com',
'name' => 'Recipient name',
],
'replyTo' => [
'email' => 'support@senderexample.com',
'name' => 'Support',
],
'subject' => 'Hello subject',
'html' => 'Hello, World!',
'text' => 'Hello, World!',
'tags' => [
'mailerApiSend',
],
'headers' => [
'X-Additional-Header' => 'additional-header-value',
],
'priority' => 1,
]);
/**
* Request Example
*/
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
//curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_INFILESIZE, null);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Access-Token: $accessToken",
'Content-Type: application/json',
'Content-Length: ' . strlen($body),
]);
$result = curl_exec($ch);
if ($result === false) {
echo 'cURL error:' . curl_error($ch) . PHP_EOL;
} else {
echo strval($result) . PHP_EOL;
}
curl_close($ch);