Use this method to send a quick email to a single customer. The method is useful for re-sending a message a customer deleted without reading, or sending a message missed by a new subscriber on your list.
The 'emailId' is the ID of the message that you want to resend.
You must include the properties of the email you want to create.
|contactid||integer||The contact id is the ID of the contact you want to re-send it to|
The API will only send to a contact on the list of the originally sent message.
The system will return either a success or failure message. If the request failed, the system will provide you with an error message.
$json = '
$url = '(Your URL)/api/3.0/emails/resend/(The emailId)';
$method = 'POST';
$cSession = curl_init();
$headers = array();
$auth = base64_encode($username . ':' . $apikey);
$headers = 'Authorization: Basic ' . $auth;
curl_setopt($cSession, CURLOPT_URL, $url);
curl_setopt($cSession, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cSession, CURLOPT_HEADER, false);
curl_setopt($cSession, CURLOPT_CUSTOMREQUEST, strtoupper($method));
curl_setopt($cSession, CURLOPT_POSTFIELDS, $json);
$headers = 'Content-Type: application/json';
curl_setopt($cSession, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($cSession);
The rest of this document describes the example above, step-by-step.
In our Getting Started section we covered the four important components of an API request; URL, method, headers, and body.
Let's analyse the code sample above to determine where each line fits into this outline.
The following line of code tells the server which API URL to access for the request. Replace the email ID in brackets with the ID of the email you want to send.
In this line of code, you tell the API which REST function to use:
cURL is a tool for sending and receiving files from a web server. This line of code initialises the cURL session.
This section of the code opens the headers section and passes the authentication (including your API key).
The first line uses the $url to get your specified url
The second line returns the string (text) of the return value.
The third line tells the server not to include the header in the ouput.
The fourth line calls the $method specified above.
Call the headers using the $headers method.