REST Email Marketing API Documentation

DOCUMENTS — TEST SEND

Perform mail merging on a document and send it to the specified email address.

HTTP VERB

Post

URL

/API/Rest/Documents/TestSend

ARGUMENTS

documentName The name of the document to send. Must be of type 'User'
emailAddress The email address of an existing recipient.
substitutions A string dictionary of keys and values for substitution.

Required permission

ViewDocument

ERRORS

No Permission
Invalid email address
Invalid document name
Invalid document type
No DNS MX entries for this domain
No virtual IP address configured
Unable to find a address that can be used for sending
An error occurred attempting to mail merge
Unable to retrieve dynamic mail merge data
The receiving mail server did not accept the mail, returning a message indicating the IP address has been blocked
The receiving mail server did not accept our attempt to connect
The receiving mail server returned a temporary failure code, implementing a strategy called "greylisting"
The receiving mail server said the mailbox is full
The receiving mail server did not accept the mail, complaining about too much email being sent, but saying that you could try again later
The receiving mail server rejected the mail, categorizing it as SPAM
The receiving mail server rejected the mail saying that the email address is unknown
The receiving mail server rejected the mail for an unknown reason
Database error
Unknown error

RETURNS

The document was accepted by the receiving mail server

EXAMPLE

Send a test document with dynamic substitutions.

using System;
using System.Net.Http;
using System.Text;

string url = "https://example.com/API/Rest/Documents/TestSend";
string message = "{\"accountName\":\"acme\",\"login\":\"ApiUser\",\"password\":\"YOUR_PASSWORD\",\"documentName\":\"Survey\",\"emailAddress\":\"joe@example.com\",\"substitutions\":{\"survey_link\":\"http://www.google.com\",\"unsub_link\":\"http://getmeoff.com\"}}";

// Reuse HttpClient for multiple requests in production code.
using (var client = new HttpClient())
using (var request = new HttpRequestMessage(HttpMethod.Post, url))
{
	request.Content = new StringContent(message, Encoding.UTF8, "application/json");

	using (HttpResponseMessage response = await client.SendAsync(request))
	{
		response.EnsureSuccessStatusCode();
		Console.WriteLine(await response.Content.ReadAsStringAsync());
	}
}
			
# encoding: utf-8
require 'rest-client'
require 'json'
							
url = 'https://example.com/API/Rest/Documents/TestSend'
args = {'accountName'=>'acme', 'login'=>'ApiUser', 
'password'=>'YOUR_PASSWORD', 'documentName'=>'Survey', 'emailAddress'=>'joe@example.com', 'substitutions'=>{'survey_link'=>'http://www.google.com','unsub_link'=>'http://getmeoff.com'}}
response = RestClient.post(url, args.to_json, :content_type => "application/json;charset=utf-8")
puts response	
						
import requests

url = "https://example.com/API/Rest/Documents/TestSend?accountName=Acme&login=ApiUser&emailAddress=joe@example.com"
args = {'accountName':'acme','login':'ApiUser','password':'YOUR_PASSWORD', 'documentName':'Survey', 'emailAddress':'joe@example.com', 'substitutions':{'survey_link':'http://www.google.com', 'unsub_link':'http://getmeoff.com'}}
headers = {'Content-Type': 'application/json'}
resp = requests.post(url, json=args, headers=headers)
if resp.status_code == 200:
	print(resp.text)
curl --request POST --header "Content-Type: application/json" --data '{"accountName":"acme","login":"ApiUser", "password":"YOUR_PASSWORD", "documentName":"Survey", "emailAddress":"joe@example.com", "substitutions":{"survey_link":"http://www.google.com", "unsub_link":"http://getmeoff.com"}}' "https://example.com/API/Rest/Documents/TestSend"