Send a Test Email
curl --request POST \
--url https://cloudapi.mailercloud.com/v1/campaign/testmail/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: <content-type>' \
--data '
{
"email": "sender@yourdomain.com",
"testmail_group": "group_name/group_id"
}
'import requests
url = "https://cloudapi.mailercloud.com/v1/campaign/testmail/{id}"
payload = {
"email": "sender@yourdomain.com",
"testmail_group": "group_name/group_id"
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<api-key>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<api-key>'},
body: JSON.stringify({email: 'sender@yourdomain.com', testmail_group: 'group_name/group_id'})
};
fetch('https://cloudapi.mailercloud.com/v1/campaign/testmail/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cloudapi.mailercloud.com/v1/campaign/testmail/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => 'sender@yourdomain.com',
'testmail_group' => 'group_name/group_id'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://cloudapi.mailercloud.com/v1/campaign/testmail/{id}"
payload := strings.NewReader("{\n \"email\": \"sender@yourdomain.com\",\n \"testmail_group\": \"group_name/group_id\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"message": "Test mail was successfully sent"
}{
"errors": [
{
"field": "email",
"message": "Email must be a valid email address"
}
]
}{
"errors": [
{
"field": "",
"message": "Authorization failed"
}
]
}{
"error": {
"field": "id",
"message": "Record not found with the given Id"
}
}Send a Test Email
Send a test email.
POST
/
campaign
/
testmail
/
{id}
Send a Test Email
curl --request POST \
--url https://cloudapi.mailercloud.com/v1/campaign/testmail/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: <content-type>' \
--data '
{
"email": "sender@yourdomain.com",
"testmail_group": "group_name/group_id"
}
'import requests
url = "https://cloudapi.mailercloud.com/v1/campaign/testmail/{id}"
payload = {
"email": "sender@yourdomain.com",
"testmail_group": "group_name/group_id"
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<api-key>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<api-key>'},
body: JSON.stringify({email: 'sender@yourdomain.com', testmail_group: 'group_name/group_id'})
};
fetch('https://cloudapi.mailercloud.com/v1/campaign/testmail/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cloudapi.mailercloud.com/v1/campaign/testmail/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => 'sender@yourdomain.com',
'testmail_group' => 'group_name/group_id'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://cloudapi.mailercloud.com/v1/campaign/testmail/{id}"
payload := strings.NewReader("{\n \"email\": \"sender@yourdomain.com\",\n \"testmail_group\": \"group_name/group_id\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"message": "Test mail was successfully sent"
}{
"errors": [
{
"field": "email",
"message": "Email must be a valid email address"
}
]
}{
"errors": [
{
"field": "",
"message": "Authorization failed"
}
]
}{
"error": {
"field": "id",
"message": "Record not found with the given Id"
}
}Authorizations
Your Mailercloud API key (plain text, no Bearer prefix). Create keys in Settings → API.
Headers
application/json
Path Parameters
Campaign Id
Response
OK
Minimum string length:
1⌘I