Send Email

You can use this method in order to send transactional emails through API

Method: POST

URL: https://api.retargeting.app/v1/transactional/emails/send

Field Type Required Description
k number or text True The REST API Key can be found into your account Settings -> Integration -> REST API Key, second field.
email email True The buyer's e-mail address
sender email True Your e-mail address
from_name text True Your name
subject text True The email subject with a minimum length of 3 characters and a maximum of 250 characters
content text True Email content
cc_list email Optional Will be sent as an array, up to a maximum of 10 email addresses
bcc_list email Optional Will be sent as an array, up to a maximum of 10 email addresses
attachment file Optional Maximum size 1 MB
attachment_filename text Optional If there is an attachment and you want to change the file name, you can add the new file name here but keep in mind to add its extension also

The API call will respond with JSON format.

Example

   <?php
   require_once "vendor/autoload.php";
   $apiURL = "https://api.retargeting.app/v1/";
   $apiKey = "MyAPI_REST_Key";
   $client = new GuzzleHttp\Client();
   $registerData = [
       "k" => $apiKey,
       "email" => "email@example.com"
       "sender" => "offer@examplestore.com"
       "from_name" => "John Dave"
       "subject" => "Great discount for new products"
       "content" => "Discover the latest fashion trends with John Dave Storee. Shop the new collection of clothing, footwear, accessories, beauty products and more. Order today from John Dave!"
       "cc_list" => "["email1@example.com", "email2@example.com"]"
       "bcc_list" => "["email3@example.com", "email4@example.com"]"
       "attachment" => "file"
       "attachment_filename" => "invoice.png"
   ];
   $registerRequest = $client->request("POST", $apiURL . "transactional/emails/send", ["query" => $registerData]);

If the API call succeeds, then the response will be as seen below:

{
    status: "success",
    data: {
        "message": "Email sent successfully"
    }
}

If the API call fails, the response will be as seen below:

{
    status: "error",
    data: {
        "message": "Incorrect key!"
    }
}

OR

{
    status: "error",
    data: {
        "message": "The subject field is required."
    }
}