Overview
Use this method to send a preview email to a specific email address. You must specify the ID of the email you want to preview, and the email address of the recipient you want the system to send the preview to.
The Method
API | - | Method |
---|---|---|
REST | POST | https://[Your URL]/api/2.0/email_preview/:id/:recipient |
XML-RPC | Call | emails.PreviewEmail |
Your URL is the address of your install.
Your method must be structured as follows:
PreviewEmail(integer $id, string $recipient) : boolean
Parameters
Required Parameters
The following parameters are required for this method to work:
Property | Type | Description | Required |
---|---|---|---|
$id | integer | The ID of the email to create a preview of. | yes |
$recipient | string | The email address of the person to which the preview must be sent. | yes |
Responses
Type | Description |
---|---|
boolean | If the preview was successful or not. |
Code Samples
PHP (using REST API):
$recipient = '[email protected]'; $url = '(Your URL)/api/2.0/email_actions/email_preview/:email_id/' . $recipient; $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_HTTPHEADER, $headers); $result = curl_exec($cSession); curl_close($cSession);