/messages/sendMail
Example Request JSON
{
"owner_id": "example id",
"token": "example token",
"smtp_user_name":"smtp12345",
"message": {
"html": "Example HTML content",
"text": "Example text content",
"subject": "example subject",
"from_email": "message.from_email@example.com",
"from_name": "Example Name",
"to": [
{
"email": "recipient.email@example.com",
"name": "Recipient Name",
"type": "to"
}
],
"headers": {
"Reply-To": "message.reply@example.com",
"X-Unique-Id": "id "
},
"attachments": [
{
"type": "text/plain",
"name": "myfile.txt",
"content": "ZXhhbXBsZSBmaWxl"
}
],
"images": [
{
"type": "image/png",
"name": "IMAGECID",
"content": "ZXhhbXBsZSBmaWxl"
}
]
}
}
Example Success Response
{
"status" : "success",
"message" : "message have been Queued ... ";
}
Example Error Response
{
"status": "error",
"code": -1,
"name": "AuthenticationError",
"message": "Token MissMatch"
}
| Parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| owner_id* string | a valid SendCleanUser Id | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| token* string | a valid token | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| smtp_user_name* string | a valid smtp user name | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| message* struct | the information on the message to send
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
** Either 'html' field Or 'text' field compulsory
| Return Value: Success | ||||||
|---|---|---|---|---|---|---|
|
||||||
| Return Value: Error | ||||||||
|---|---|---|---|---|---|---|---|---|
|
||||||||
| Error types | |
|---|---|
| ValidationError | The parameters passed to the API call are invalid or not provided when required. |
| GeneralError | An unexpected errors occurred processing the request. SendCleanDevelopers will be notified. |
| AuthenticationError | Provided owner_id and token was not matched. |
/messages/sendTemplate
Send a new transactional message using templates
Example Request JSON
{
"owner_id": "example id",
"token": "example token",
"smtp_user_name":"smtp12345",
"message": {
"template_id": "Template Id",
"subject": "example subject",
"from_email": "message.from_email@example.com",
"from_name": "Example Name",
"to": [
{
"email": "recipient.email@example.com",
"name": "Recipient Name",
"type": "to"
}
],
"headers": {
"Reply-To": "message.reply@example.com",
"X-Unique-Id": "id "
},
"dynamic_value": {
"NAME": "xyz",
"Email": "info@example.com"
},
"attachments": [
{
"type": "text/plain",
"name": "myfile.txt",
"content": "ZXhhbXBsZSBmaWxl"
}
],
"images": [
{
"type": "image/png",
"name": "IMAGECID",
"content": "ZXhhbXBsZSBmaWxl"
}
]
}
}
Example Success Response
{
"status" : "success",
"message" : "250 Message Queued...";
}
Example Error Response
{
"status": "error",
"code": -1,
"name": "AuthenticationError",
"message": "Token MissMatch"
}
| Parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| owner_id* string | a valid SendCleanUser Id | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| token* string | a valid token | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| smtp_user_name* string | a valid smtp user name | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| message* struct | the information on the message to send
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Return Value: Success | ||||||
|---|---|---|---|---|---|---|
|
||||||
| Return Value: Error | ||||||||
|---|---|---|---|---|---|---|---|---|
|
||||||||
| Error types | |
|---|---|
| ValidationError | The parameters passed to the API call are invalid or not provided when required. |
| GeneralError | An unexpected errors occurred processing the request. SendCleanDevelopers will be notified. |
| AuthenticationError | Provided owner_id and token was not matched. |
/messages/sendTemplateHTTPGet
Send a new transactional message using templates (HTTP GET method)
Note: Use this method to integrate third party applications (Like IVR webhooks). It requires less dependency. All name and values should be URL encoded. See here
Example HTTP GET request using cURL
curl "http://api.SendCleanTES_APP_DOMAIN/v1.0/messages/sendTemplateHTTPGet?owner_id=owner_id&token=token&smtp_user_name=smtp12345&template_id=template_id&subject=hello&from_email=info%40example.com&to=xyz%40example.com&dynamic_value%5BNAME%5D=xyz&dynamic_value%5BEmail%5D=xyz%40example.com"
Example Success Response
{
"status" : "success",
"message" : "250 Message Queued...";
}
Example Error Response
{
"status": "error",
"code": -1,
"name": "AuthenticationError",
"message": "Token MissMatch"
}
| Parameters | |||||
|---|---|---|---|---|---|
| owner_id* string | a valid SendCleanUser Id | ||||
| token* string | a valid token | ||||
| smtp_user_name* string | a valid smtp user name | ||||
| template_id* string | a valid previously created template id | ||||
| subject* string | URL encoded subject | ||||
| from_email* string | URL encoded from email | ||||
| to* string | URL encoded to email | ||||
| dynamic_value struct | optional dynamic values to replace dynamic fields on template. Dynamic fields are case sensitive. Example
|
||||
| Return Value: Success | ||||||
|---|---|---|---|---|---|---|
|
||||||
| Return Value: Error | ||||||||
|---|---|---|---|---|---|---|---|---|
|
||||||||
| Error types | |
|---|---|
| ValidationError | The parameters passed to the API call are invalid or not provided when required. |
| GeneralError | An unexpected errors occurred processing the request. SendCleanDevelopers will be notified. |
| AuthenticationError | Provided owner_id and token was not matched. |
/messages/getMessageInfo
get list of messages of specific x-unique-id
Example Call
{
"owner_id": "example id",
"token": "example token",
"x_unique_id":"test",
"skip_page":0
}
Example Success Response
{
"status": "success",
"message_data": [{
"subject": "this is subject ..",
"sender": "xyz@SendClean.com",
"email": "abc@SendClean.com",
"sendFrom": "0.0.0.0",
"mailSize": 1919,
"attchSize": 0,
"status": "delivered",
"time": 1458034022169,
"open": 1,
"openData": {
"ip": [
"0.0.0.0", "0.0.0.0"
],
"ua": [
"Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)",
"Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)"
],
"time": [
1458039067963, 1458039067978
]
},
"clickData": {
"ip": [
"0.0.0.0", "0.0.0.0"
],
"ua": [
"Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)",
"Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)"
],
"time": [
1458039068888, 1458039069999
]
},
"click": 1
}]
}
Example Error Response
{
"status": "error",
"code": -1,
"name": "AuthenticationError",
"message": "Token MissMatch"
}
| Parameters | ||
|---|---|---|
| owner_id* string | a valid SendCleanUser Id | |
| token* string | a valid token | |
| SendCleanTES_APP_DOMAIN* string | a valid SendCleanTES APP DOMAIN | |
| x_unique_id* string | a valid x-unique-id | |
| skip_page integer | a valid skip page | |
| Return Value: Success | ||||||
|---|---|---|---|---|---|---|
|
||||||
| Return Value: Error | ||||||||
|---|---|---|---|---|---|---|---|---|
|
||||||||
| Error types | |
|---|---|
| ValidationError | The parameters passed to the API call are invalid or not provided when required. |
| GeneralError | An unexpected errors occurred processing the request. SendCleanDevelopers will be notified. |
| AuthenticationError | Provided owner_id and token was not matched. |
/messages/sendMail
Example Call
<?php
$recipients = array(
array(
'email' => 'recipient1.email@example.com',
'name' => 'Recipient1 Name'
),
array(
'email' => 'recipient2.email@example.com',
'name' => 'Recipient2 Name'
)
);
try {
require_once 'SendCleanMTA_PHP/SendClean.php';
$SendClean= new SendClean('owner_id', 'token', 'SendCleanTES_APP_DOMAIN');
$smtp_user_name = "smtp12345";
foreach ($recipients as $recipient) {
$message = array();
$message["html"] = "Example HTML content";
$message["text"] = "Example text content";
$message["subject"] = "example subject";
$message["from_email"] = "from_email@example.com";
$message["to"] = array(
array("email" => $recipient['email'], "name" => $recipient['name'], "type" => "to")
);
$message["headers"] = array("Reply-To" => "message.reply@example.com", "X-Unique-Id" => "Id");
$message["attachments"] = array(array("type" => "text/plain", "name" => "myfile.txt", "content" => "ZXhhbXBsZSBmaWxl"));
$message["images"] = array(array("type" => "image/png", "name" => "IMAGECID", "content" => "dgfdddger"));
$result = $SendClean->messages->sendMail($smtp_user_name, $message);
print_r($result);
/*
Array
(
[status] => "success"
[message] => "message have been Queued ... "
)
*/
}
} catch (SendClean_Error $e) {
// SendCleanerrors are thrown as exceptions
echo "A SendCleanerror occurred: " . get_class($e) . " - " . $e->getMessage();
}
?>
Example Success Response
Array
(
[status] => "success"
[message] => "message have been Queued ... "
)
Example Error Response
Array
(
[status]=> "error"
[code]=> -1
[name]=> "AuthenticationError"
[message]=> "Token MissMatch"
)
| Parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| owner_id* string | a valid SendCleanUser Id | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| token* string | a valid token | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SendCleanTES_APP_DOMAIN* string | a valid SendCleanTES APP DOMAIN | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| smtp_user_name* string | a valid smtp user name | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| message* struct | the information on the message to send
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
** Either 'html' field Or 'text' field compulsory
| Return Value: Success | ||||||
|---|---|---|---|---|---|---|
|
||||||
| Return Value: Error | ||||||||
|---|---|---|---|---|---|---|---|---|
|
||||||||
| Error types | |
|---|---|
| ValidationError | The parameters passed to the API call are invalid or not provided when required. |
| GeneralError | An unexpected errors occurred processing the request. SendCleanDevelopers will be notified. |
| AuthenticationError | Provided owner_id and token was not matched. |
/messages/sendTemplate
Send a new transactional message using templates
Example Call
<?php
$recipients = array(
array(
'email' => 'recipient1.email@example.com',
'name' => 'Recipient1 Name'
),
array(
'email' => 'recipient2.email@example.com',
'name' => 'Recipient2 Name'
)
);
try {
require_once 'SendCleanMTA_PHP/SendClean.php';
$SendClean= new SendClean('owner_id', 'token', 'SendCleanTES_APP_DOMAIN');
$smtp_user_name = "smtp12345";
foreach ($recipients as $recipient) {
$message = array();
$message["template_id"] = "template id";
$message["subject"] = "example subject";
$message["from_email"] = "from_email@example.com";
$message["to"] = array(
array("email" => $recipient['email'], "name" => $recipient['name'], "type" => "to")
);
$message["headers"] = array("Reply-To" => "message.reply@example.com", "X-Unique-Id" => "Id");
$message["dynamic_value"] = array("NAME" => "xyz", "Email" => "info@example.com");
$message["attachments"] = array(array("type" => "text/plain", "name" => "myfile.txt", "content" => "ZXhhbXBsZSBmaWxl"));
$message["images"] = array(array("type" => "image/png", "name" => "IMAGECID", "content" => "dgfdddger"));
$result = $SendClean->messages->sendTemplate($smtp_user_name, $message);
print_r($result);
/*
Array
(
[status] => "success"
[message] => "message have been Queued ... "
)
*/
}
} catch (SendClean_Error $e) {
// SendCleanerrors are thrown as exceptions
echo "A SendCleanerror occurred: " . get_class($e) . " - " . $e->getMessage();
}
?>
Example Success Response
Array
(
[status] => "success"
[message] => "message have been Queued ... "
)
Example Error Response
Array
(
[status]=> "error"
[code]=> -1
[name]=> "AuthenticationError"
[message]=> "Token MissMatch"
)
| Parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| owner_id* string | a valid SendCleanUser Id | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| token* string | a valid token | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SendCleanTES_APP_DOMAIN* string | a valid SendCleanTES APP DOMAIN | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| smtp_user_name* string | a valid smtp user name | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| message* struct | the information on the message to send
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Return Value: Success | ||||||
|---|---|---|---|---|---|---|
|
||||||
| Return Value: Error | ||||||||
|---|---|---|---|---|---|---|---|---|
|
||||||||
| Error types | |
|---|---|
| ValidationError | The parameters passed to the API call are invalid or not provided when required. |
| GeneralError | An unexpected errors occurred processing the request. SendCleanDevelopers will be notified. |
| AuthenticationError | Provided owner_id and token was not matched. |
/messages/sendTemplateHTTPGet
Send a new transactional message using templates (HTTP GET method). This method doesn't require SendCleanLibrary.
Example Call
<?php
$query = array(
'owner_id' => 'owner_id',
'token' => 'token',
'smtp_user_name' => 'smtp123456',
'template_id' => 'template_id',
'subject' => 'hello',
'from_email' => 'hello@example.com',
'to' => 'info@example.com',
'dynamic_value' => array('NAME' => 'xyz', 'Email' => 'xyz@example.com')
);
$url = "http://api.SendCleanTES_APP_DOMAIN/v1.0/messages/sendTemplateHTTPGet?" . http_build_query($query);
echo file_get_contents($url);
?>
Example Success Response
{
"status" : "success",
"message" : "250 Message Queued...";
}
Example Error Response
{
"status": "error",
"code": -1,
"name": "AuthenticationError",
"message": "Token MissMatch"
}
| Parameters | |||||
|---|---|---|---|---|---|
| owner_id* string | a valid SendCleanUser Id | ||||
| token* string | a valid token | ||||
| smtp_user_name* string | a valid smtp user name | ||||
| template_id* string | a valid previously created template id | ||||
| subject* string | URL encoded subject | ||||
| from_email* string | URL encoded from email | ||||
| to* string | URL encoded to email | ||||
| dynamic_value struct | optional dynamic values to replace dynamic fields on template. Dynamic fields are case sensitive. Example
|
||||
| Return Value: Success | ||||||
|---|---|---|---|---|---|---|
|
||||||
| Return Value: Error | ||||||||
|---|---|---|---|---|---|---|---|---|
|
||||||||
| Error types | |
|---|---|
| ValidationError | The parameters passed to the API call are invalid or not provided when required. |
| GeneralError | An unexpected errors occurred processing the request. SendCleanDevelopers will be notified. |
| AuthenticationError | Provided owner_id and token was not matched. |
/messages/getMessageInfo
get list of messages of specific x-unique-id
Note:- By default first 100 record will be fetch
if don't pass second argument i.e. '$skip_page' or pass value of '$skip_page' is 0,
if you want to fetch next 100 record then pass value of '$skip_page' is 1, and so on.
Example Call
<?php
try {
require_once 'SendCleanMTA_PHP/SendClean.php';
$SendClean= new SendClean('owner_id', 'token', 'SendCleanTES_APP_DOMAIN');
$x_unique_id = "test";
$skip_page = 0;
$result = $SendClean->messages->getMessageInfo($x_unique_id, $skip_page);
print_r($result);
/*
Array
(
[status] => "success"
[message_data] => Array
(
[0] => Array
(
[subject] => this is subject ..
[sender] => xyz@SendClean.com
[email] => abc@SendClean.com
[sendFrom] => 10.0.0.0
[mailSize] => 1919
[attchSize] => 0
[status] => delivered
[time] => 1458034022169
[open] => 1
[openData] => Array
(
[ip] => Array
(
[0] => 0.0.0.0
[1] => 0.0.0.0
)
[ua] => Array
(
[0] => Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)
[1] => Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)
)
[time] => Array
(
[0] => 1458039067963
[1] => 1458039067978
)
)
[clickData] => Array
(
[ip] => Array
(
[0] => 0.0.0.0
[1] => 0.0.0.0
)
[ua] => Array
(
[0] => Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)
[1] => Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)
)
[time] => Array
(
[0] => 1458039068888
[1] => 1458039069999
)
)
[click] => 1
)
)
)
*/
} catch(SendClean_Error $e) {
// SendCleanerrors are thrown as exceptions
echo "A SendCleanerror occurred: " . get_class($e) . " - " . $e->getMessage();
}
?>
Example Success Response
Array
(
[status] => "success"
[message_data] => Array
(
[0] => Array
(
[subject] => this is subject ..
[sender] => xyz@SendClean.com
[email] => abc@SendClean.com
[sendFrom] => 10.0.0.0
[mailSize] => 1919
[attchSize] => 0
[status] => delivered
[time] => 1458034022169
[open] => 1
[openData] => Array
(
[ip] => Array
(
[0] => 0.0.0.0
[1] => 0.0.0.0
)
[ua] => Array
(
[0] => Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)
[1] => Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)
)
[time] => Array
(
[0] => 1458039067963
[1] => 1458039067978
)
)
[clickData] => Array
(
[ip] => Array
(
[0] => 0.0.0.0
[1] => 0.0.0.0
)
[ua] => Array
(
[0] => Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)
[1] => Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)
)
[time] => Array
(
[0] => 1458039068888
[1] => 1458039069999
)
)
[click] => 1
)
)
)
Example Error Response
Array
(
[status]=> "error"
[code]=> -1
[name]=> "AuthenticationError"
[message]=> "Token MissMatch"
)
| Parameters | ||
|---|---|---|
| owner_id* string | a valid SendCleanUser Id | |
| token* string | a valid token | |
| SendCleanTES_APP_DOMAIN* string | a valid SendCleanTES APP DOMAIN | |
| x_unique_id* string | a valid x-unique-id | |
| skip_page integer | a valid skip page | |
| Return Value: Success | ||||||
|---|---|---|---|---|---|---|
|
||||||
| Return Value: Error | ||||||||
|---|---|---|---|---|---|---|---|---|
|
||||||||
| Error types | |
|---|---|
| ValidationError | The parameters passed to the API call are invalid or not provided when required. |
| GeneralError | An unexpected errors occurred processing the request. SendCleanDevelopers will be notified. |
| AuthenticationError | Provided owner_id and token was not matched. |
/messages/sendMail
Example Call
try:
import SendClean
SendClean_client = SendClean.SendClean('owner_id', 'token', 'SendCleanTES_APP_DOMAIN')
smtp_user_name = "smtp12345";
message = {};
message["html"] = "Example HTML content";
message["text"] = "Example text content";
message["subject"] = "example subject";
message["from_email"] = "from_email@example.com";
message["to"] = [{"email" : "recipient.email@example.com","name" : "Recipient Name","type" : "to"}];
message["headers"] = {"Reply-To" : "message.reply@example.com","X-Unique-Id" : "Id"};
message["attachments"] = [{"type" : "text/plain","name" : "myfile.txt","content" : "ZXhhbXBsZSBmaWxl"}];
message["images"] = [{"type" : "image/png","name" : "IMAGECID","content" : "dgfdddger"}];
result = SendClean_client.messages.sendMail(smtp_user_name, message)
print result
'''
{
"status" : "success",
"message" : "message have been Queued ... "
}
'''
except SendClean.Error, e:
# SendCleanerrors are thrown as exceptions
print 'A SendCleanerror occurred: %s - %s' % (e.__class__, e)
Example Success Response
{
"status" : "success",
"message" : "message have been Queued ... "
}
Example Error Response
{
"status": "error",
"code": -1,
"name": "AuthenticationError",
"message": "Token MissMatch"
}
| Parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| owner_id* string | a valid SendCleanUser Id | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| token* string | a valid token | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SendCleanTES_APP_DOMAIN* string | a valid SendCleanTES APP DOMAIN | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| smtp_user_name* string | a valid smtp user name | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| message* struct | the information on the message to send
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
** Either 'html' field Or 'text' field compulsory
| Return Value: Success | ||||||
|---|---|---|---|---|---|---|
|
||||||
| Return Value: Error | ||||||||
|---|---|---|---|---|---|---|---|---|
|
||||||||
| Error types | |
|---|---|
| ValidationError | The parameters passed to the API call are invalid or not provided when required. |
| GeneralError | An unexpected errors occurred processing the request. SendCleanDevelopers will be notified. |
| AuthenticationError | Provided owner_id and token was not matched. |
/messages/sendTemplate
Send a new transactional message using templates
Example Call
try:
import SendClean
SendClean_client = SendClean.SendClean('owner_id', 'token', 'SendCleanTES_APP_DOMAIN')
smtp_user_name = "smtp12345";
message = {};
message["template_id"] = "template id";
message["subject"] = "example subject";
message["from_email"] = "from_email@example.com";
message["to"] = [{"email" : "recipient.email@example.com","name" : "Recipient Name","type" : "to"}];
message["headers"] = {"Reply-To" : "message.reply@example.com","X-Unique-Id" : "Id"};
message["dynamic_value"] = {"NAME" : "xyz","Email" : "info@example.com"};
message["attachments"] = [{"type" : "text/plain","name" : "myfile.txt","content" : "ZXhhbXBsZSBmaWxl"}];
message["images"] = [{"type" : "image/png","name" : "IMAGECID","content" : "dgfdddger"}];
result = SendClean_client.messages.sendTemplate(smtp_user_name, message)
print result
'''
{
"status" : "success",
"message" : "message have been Queued ... "
}
'''
except SendClean.Error, e:
# SendCleanerrors are thrown as exceptions
print 'A SendCleanerror occurred: %s - %s' % (e.__class__, e)
Example Success Response
{
"status" : "success",
"message" : "message have been Queued ... "
}
Example Error Response
{
"status": "error",
"code": -1,
"name": "AuthenticationError",
"message": "Token MissMatch"
}
| Parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| owner_id* string | a valid SendCleanUser Id | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| token* string | a valid token | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SendCleanTES_APP_DOMAIN* string | a valid SendCleanTES APP DOMAIN | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| smtp_user_name* string | a valid smtp user name | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| message* struct | the information on the message to send
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Return Value: Success | ||||||
|---|---|---|---|---|---|---|
|
||||||
| Return Value: Error | ||||||||
|---|---|---|---|---|---|---|---|---|
|
||||||||
| Error types | |
|---|---|
| ValidationError | The parameters passed to the API call are invalid or not provided when required. |
| GeneralError | An unexpected errors occurred processing the request. SendCleanDevelopers will be notified. |
| AuthenticationError | Provided owner_id and token was not matched. |
/messages/sendTemplateHTTPGet
Send a new transactional message using templates (HTTP GET method). This method doesn't require SendCleanLibrary.
Example Call
import urllib
import urllib2
try:
SendCleanTES_APP_DOMAIN = "SendCleanTES_APP_DOMAIN"
formData = {
'owner_id':'owner_id',
'token': 'token',
'smtp_user_name':'smtp123456',
'template_id': 'template_id',
'subject': 'hello',
'from_email':'hello@example.com',
'to':'info@example.com',
'dynamic_value[NAME]':'xyz',
'dynamic_value[Email]':'xyz@example.com'
}
encodedFormData = urllib.urlencode(formData)
res = urllib2.urlopen("http://api." + SendCleanTES_APP_DOMAIN + "/v1.0/messages/sendTemplateHTTPGet?" + encodedFormData).read()
print(res)
except:
print("Unexpected error:", sys.exc_info()[0])
Example Success Response
{
"status" : "success",
"message" : "250 Message Queued...";
}
Example Error Response
{
"status": "error",
"code": -1,
"name": "AuthenticationError",
"message": "Token MissMatch"
}
| Parameters | |||||
|---|---|---|---|---|---|
| owner_id* string | a valid SendCleanUser Id | ||||
| token* string | a valid token | ||||
| smtp_user_name* string | a valid smtp user name | ||||
| template_id* string | a valid previously created template id | ||||
| subject* string | URL encoded subject | ||||
| from_email* string | URL encoded from email | ||||
| to* string | URL encoded to email | ||||
| dynamic_value struct | optional dynamic values to replace dynamic fields on template. Dynamic fields are case sensitive. Example
|
||||
| Return Value: Success | ||||||
|---|---|---|---|---|---|---|
|
||||||
| Return Value: Error | ||||||||
|---|---|---|---|---|---|---|---|---|
|
||||||||
| Error types | |
|---|---|
| ValidationError | The parameters passed to the API call are invalid or not provided when required. |
| GeneralError | An unexpected errors occurred processing the request. SendCleanDevelopers will be notified. |
| AuthenticationError | Provided owner_id and token was not matched. |
/messages/getMessageInfo
get list of messages of specific x-unique-id
Note:- By default first 100 record will be fetch
if don't pass second argument i.e. 'skip_page' or pass value of 'skip_page' is 0,
if you want to fetch next 100 record then pass value of 'skip_page' is 1, and so on.
Example Call
try:
import SendClean
SendClean_client = SendClean.SendClean('owner_id', 'token', 'SendCleanTES_APP_DOMAIN')
x_unique_id = "test";
skip_page = 0;
result = SendClean_client.messages.getMessageInfo(x_unique_id, skip_page)
print result
'''
{
"status": "success",
"message_data": [
{
"subject": "this is subject ..",
"sender": "xyz@SendClean.com",
"email": "abc@SendClean.com",
"sendFrom": "0.0.0.0",
"mailSize": 1919,
"attchSize": 0,
"status": "delivered",
"time": 1458034022169,
"open": 1,
"openData": {
"ip": [
"0.0.0.0",
"0.0.0.0"
],
"ua": [
"Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)",
"Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)"
],
"time": [
1458039067963,
1458039067978
]
},
"clickData": {
"ip": [
"0.0.0.0",
"0.0.0.0"
],
"ua": [
"Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)",
"Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)"
],
"time": [
1458039068888,
1458039069999
]
},
"click": 1
}
]
}
'''
except SendClean.Error, e:
# SendCleanerrors are thrown as exceptions
print 'A SendCleanerror occurred: %s - %s' % (e.__class__, e)
Example Success Response
{
"status" : "success",
"message_data" : [
{
"subject" : "this is subject ..",
"sender" : "xyz@SendClean.com",
"email" : "abc@SendClean.com",
"sendFrom" : "0.0.0.0",
"mailSize" : 1919,
"attchSize" : 0,
"status" : "delivered",
"time" : 1458034022169,
"open" : 1,
"openData" : {
"ip": [
"0.0.0.0","0.0.0.0"
],
"ua": [
"Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)",
"Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)"
],
"time": [
"1458039067963","1458039067978"
]
},
"clickData" : {
"ip": [
"0.0.0.0","0.0.0.0"
],
"ua": [
"Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)",
"Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)"
],
"time": [
"1458039068888","1458039069999"
]
},
"click" : 1
}
]
}
Example Error Response
{
"status": "error",
"code": -1,
"name": "AuthenticationError",
"message": "Token MissMatch"
}
| Parameters | ||
|---|---|---|
| owner_id* string | a valid SendCleanUser Id | |
| token* string | a valid token | |
| SendCleanTES_APP_DOMAIN* string | a valid SendCleanTES APP DOMAIN | |
| x_unique_id* string | a valid x-unique-id | |
| skip_page integer | a valid skip page | |
** Either 'html' field Or 'text' field compulsory
| Return Value: Success | ||||||
|---|---|---|---|---|---|---|
|
||||||
| Return Value: Error | ||||||||
|---|---|---|---|---|---|---|---|---|
|
||||||||
| Error types | |
|---|---|
| ValidationError | The parameters passed to the API call are invalid or not provided when required. |
| GeneralError | An unexpected errors occurred processing the request. SendCleanDevelopers will be notified. |
| AuthenticationError | Provided owner_id and token was not matched. |
/messages/sendMail
Example Call
var SendClean= require('./SendClean.js');
var SendClean_client = new SendClean.SendClean('owner_id', 'token', 'SendCleanTES_APP_DOMAIN');
var param = {
"smtp_user_name": "smtp12345",
"message": {
"html": "Example HTML content",
"text": "Example text content",
"subject": "example subject",
"from_email": "message.from_email@example.com",
"from_name": "Example Name",
"to": [{
"email": "recipient.email@example.com",
"name": "Recipient Name",
"type": "to"
}],
"headers": {
"Reply-To": "message.reply@example.com",
"X-Unique-Id": "id "
},
"attachments": [{
"type": "text/plain",
"name": "myfile.txt",
"content": "ZXhhbXBsZSBmaWxl"
}],
"images": [{
"type": "image/png",
"name": "IMAGECID",
"content": "ZXhhbXBsZSBmaWxl"
}]
}
};
SendClean_client.messages.sendMail(param, function(result) {
console.log(result);
/*
{
"status" : "success",
"message" : "message have been Queued ... ";
}
*/
}, function(e) {
// SendCleanreturns the error as an object with name and message keys
console.log('A SendCleanerror occurred: ' + e.name + ' - ' + e.message);
});
Example Success Response
{
"status" : "success",
"message" : "message have been Queued ... ";
}
Example Error Response
{
"status": "error",
"code": -1,
"name": "AuthenticationError",
"message": "Token MissMatch"
}
| Parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| owner_id* string | a valid SendCleanUser Id | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| token* string | a valid token | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SendCleanTES_APP_DOMAIN* string | a valid SendCleanTES APP DOMAIN | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| smtp_user_name* string | a valid smtp user name | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| message* struct | the information on the message to send
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
** Either 'html' field Or 'text' field compulsory
| Return Value: Success | ||||||
|---|---|---|---|---|---|---|
|
||||||
| Return Value: Error | ||||||||
|---|---|---|---|---|---|---|---|---|
|
||||||||
| Error types | |
|---|---|
| ValidationError | The parameters passed to the API call are invalid or not provided when required. |
| GeneralError | An unexpected errors occurred processing the request. SendCleanDevelopers will be notified. |
| AuthenticationError | Provided owner_id and token was not matched. |
/messages/sendTemplate
Send a new transactional message using templates
Example Call
var SendClean= require('./SendClean.js');
var SendClean_client = new SendClean.SendClean('owner_id', 'token', 'SendCleanTES_APP_DOMAIN');
var param = {
"smtp_user_name": "smtp12345",
"message": {
"template_id": "template id"
"subject": "example subject",
"from_email": "message.from_email@example.com",
"from_name": "Example Name",
"to": [{
"email": "recipient.email@example.com",
"name": "Recipient Name",
"type": "to"
}],
"headers": {
"Reply-To": "message.reply@example.com",
"X-Unique-Id": "id "
},
"dynamic_value": {"NAME" : "xyz","Email" : "info@example.com"},
"attachments": [{
"type": "text/plain",
"name": "myfile.txt",
"content": "ZXhhbXBsZSBmaWxl"
}],
"images": [{
"type": "image/png",
"name": "IMAGECID",
"content": "ZXhhbXBsZSBmaWxl"
}]
}
};
SendClean_client.messages.sendTemplate(param, function(result) {
console.log(result);
/*
{
"status" : "success",
"message" : "message have been Queued ... ";
}
*/
}, function(e) {
// SendCleanreturns the error as an object with name and message keys
console.log('A SendCleanerror occurred: ' + e.name + ' - ' + e.message);
});
Example Success Response
{
"status" : "success",
"message" : "message have been Queued ... ";
}
Example Error Response
{
"status": "error",
"code": -1,
"name": "AuthenticationError",
"message": "Token MissMatch"
}
| Parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| owner_id* string | a valid SendCleanUser Id | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| token* string | a valid token | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SendCleanTES_APP_DOMAIN* string | a valid SendCleanTES APP DOMAIN | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| smtp_user_name* string | a valid smtp user name | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| message* struct | the information on the message to send
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Return Value: Success | ||||||
|---|---|---|---|---|---|---|
|
||||||
| Return Value: Error | ||||||||
|---|---|---|---|---|---|---|---|---|
|
||||||||
| Error types | |
|---|---|
| ValidationError | The parameters passed to the API call are invalid or not provided when required. |
| GeneralError | An unexpected errors occurred processing the request. SendCleanDevelopers will be notified. |
| AuthenticationError | Provided owner_id and token was not matched. |
/messages/sendTemplateHTTPGet
Send a new transactional message using templates (HTTP GET method). This method doesn't require SendCleanLibrary.
Example Call
var http = require('http');
var querystring = require('querystring');
var SendCleanTES_APP_DOMAIN = 'SendCleanTES_APP_DOMAIN';
var formData = {
'owner_id': 'owner_id',
'token': 'token',
'smtp_user_name': 'smtp123456',
'template_id': 'template_id',
'subject': 'hello',
'from_email': 'hello@example.com',
'to': 'info@example.com',
'dynamic_value[NAME]': 'xyz',
'dynamic_value[Email]': 'xyz@example.com'
};
var qs = querystring.stringify(formData);
var url = "http://api." + SendCleanTES_APP_DOMAIN + "/v1.0/messages/sendTemplateHTTPGet?" + qs;
http.get(url, function (res) {
const statusCode = res.statusCode;
if (statusCode !== 200) {
return console.log('Request Failed.');
}
res.setEncoding('utf8');
var rawData = '';
res.on('data', function (chunk) {
rawData += chunk;
});
res.on('end', function () {
console.log(rawData);
});
}).on('error', function (e) {
console.log(e.toString());
});
Example Success Response
{
"status" : "success",
"message" : "message have been Queued ... ";
}
Example Error Response
{
"status": "error",
"code": -1,
"name": "AuthenticationError",
"message": "Token MissMatch"
}
| Parameters | |||||
|---|---|---|---|---|---|
| owner_id* string | a valid SendCleanUser Id | ||||
| token* string | a valid token | ||||
| smtp_user_name* string | a valid smtp user name | ||||
| template_id* string | a valid previously created template id | ||||
| subject* string | URL encoded subject | ||||
| from_email* string | URL encoded from email | ||||
| to* string | URL encoded to email | ||||
| dynamic_value struct | optional dynamic values to replace dynamic fields on template. Dynamic fields are case sensitive. Example
|
||||
| Return Value: Success | ||||||
|---|---|---|---|---|---|---|
|
||||||
| Return Value: Error | ||||||||
|---|---|---|---|---|---|---|---|---|
|
||||||||
| Error types | |
|---|---|
| ValidationError | The parameters passed to the API call are invalid or not provided when required. |
| GeneralError | An unexpected errors occurred processing the request. SendCleanDevelopers will be notified. |
| AuthenticationError | Provided owner_id and token was not matched. |
/messages/getMessageInfo
get list of messages of specific x-unique-id
Example Call
var SendClean= require('./SendClean.js');
var SendClean_client = new SendClean.SendClean('owner_id', 'token', 'SendCleanTES_APP_DOMAIN');
var param = {"x_unique_id":"test", "skip_page":0};
SendClean_client.messages.getMessageInfo(param, function(result) {
console.log(result);
/*{
"status": "success",
"message_data": [
{
"subject": "this is subject ..",
"sender": "xyz@SendClean.com",
"email": "abc@SendClean.com",
"sendFrom": "0.0.0.0",
"mailSize": 1919,
"attchSize": 0,
"status": "delivered",
"time": 1458034022169,
"open": 1,
"openData": {
"ip": [
"0.0.0.0",
"0.0.0.0"
],
"ua": [
"Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)",
"Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)"
],
"time": [
1458039067963,
1458039067978
]
},
"clickData": {
"ip": [
"0.0.0.0",
"0.0.0.0"
],
"ua": [
"Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)",
"Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)"
],
"time": [
1458039068888,
1458039069999
]
},
"click": 1
}
]
}*/
}, function(e) {
// SendCleanreturns the error as an object with name and message keys
console.log('A SendCleanerror occurred: ' + e.name + ' - ' + e.message);
});
Example Success Response
{
"status" : "success",
"message_data" : [
{
"subject" : "this is subject ..",
"sender" : "xyz@SendClean.com",
"email" : "abc@SendClean.com",
"sendFrom" : "0.0.0.0",
"mailSize" : 1919,
"attchSize" : 0,
"status" : "delivered",
"time" : 1458034022169,
"open" : 1,
"openData" : {
"ip": [
"0.0.0.0","0.0.0.0"
],
"ua": [
"Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)",
"Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)"
],
"time": [
1458039067963,1458039067978
]
},
"clickData" : {
"ip": [
"0.0.0.0","0.0.0.0"
],
"ua": [
"Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)",
"Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)"
],
"time": [
1458039068888,1458039069999
]
},
"click" : 1
}
]
}
Example Error Response
{
"status": "error",
"code": -1,
"name": "AuthenticationError",
"message": "Token MissMatch"
}
| Parameters | ||
|---|---|---|
| owner_id* string | a valid SendCleanUser Id | |
| token* string | a valid token | |
| SendCleanTES_APP_DOMAIN* string | a valid SendCleanTES APP DOMAIN | |
| x_unique_id* string | a valid x-unique-id | |
| skip_page integer | a valid skip page | |
** Either 'html' field Or 'text' field compulsory
| Return Value: Success | ||||||
|---|---|---|---|---|---|---|
|
||||||
| Return Value: Error | ||||||||
|---|---|---|---|---|---|---|---|---|
|
||||||||
| Error types | |
|---|---|
| ValidationError | The parameters passed to the API call are invalid or not provided when required. |
| GeneralError | An unexpected errors occurred processing the request. SendCleanDevelopers will be notified. |
| AuthenticationError | Provided owner_id and token was not matched. |