Ресурс senderemails: адреса, с которых уходят письма. Адрес создаётся на вашем домене из раздела Домены, без писем подтверждения: его подтверждает домен. На домене можно завести сколько угодно адресов: info, support, имена сотрудников. Поля: id, email, name (имя в письме), approved (1 адрес рабочий: его домен подтверждён), default (1 основной адрес), last_approved (когда адрес стал рабочим).
GET/mailer/senderemails.json
Список адресов
Отдаёт все адреса сразу. Поля по умолчанию: id, email. Фильтр: email, approved, default. Сортировка: email, approved.
curl -G https://v1.estismail.com/mailer/senderemails.json \
-H "X-Estis-Auth: ВАШ_КЛЮЧ" \
--data-urlencode 'fields=["id","email","name","approved","default"]'<?php
$query = http_build_query([
'fields' => '["id","email","name","approved","default"]',
]);
$ch = curl_init('https://v1.estismail.com/mailer/senderemails.json' . '?' . $query);
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => ['X-Estis-Auth: ВАШ_КЛЮЧ'],
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $response;import requests
r = requests.get(
"https://v1.estismail.com/mailer/senderemails.json",
headers={"X-Estis-Auth": "ВАШ_КЛЮЧ"},
params={
"fields": '["id","email","name","approved","default"]',
},
)
print(r.status_code, r.text)const params = new URLSearchParams({
fields: '["id","email","name","approved","default"]',
});
const res = await fetch("https://v1.estismail.com/mailer/senderemails.json?" + params, {
headers: { "X-Estis-Auth": "ВАШ_КЛЮЧ" },
});
console.log(res.status, await res.text());{
"sender_emails": [
{
"id": 5501,
"email": "news@shop.example.com",
"name": "Магазин",
"approved": 1,
"default": 1
}
]
}GET/mailer/senderemails/{id}.json
Один адрес
curl https://v1.estismail.com/mailer/senderemails/5501.json \
-H "X-Estis-Auth: ВАШ_КЛЮЧ"<?php
$ch = curl_init('https://v1.estismail.com/mailer/senderemails/5501.json');
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => ['X-Estis-Auth: ВАШ_КЛЮЧ'],
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $response;import requests
r = requests.get(
"https://v1.estismail.com/mailer/senderemails/5501.json",
headers={"X-Estis-Auth": "ВАШ_КЛЮЧ"},
)
print(r.status_code, r.text)const res = await fetch("https://v1.estismail.com/mailer/senderemails/5501.json", {
headers: { "X-Estis-Auth": "ВАШ_КЛЮЧ" },
});
console.log(res.status, await res.text());{
"id": 5501,
"email": "news@shop.example.com"
}POST/mailer/senderemails.json
Добавить адрес
name и email обязательны. Домен адреса должен быть в разделе Домены, иначе ошибка 21112. Письмо подтверждения не уходит. Домен подтверждён: адрес сразу рабочий (approved 1). Не подтверждён: адрес создаётся с approved 0, рассылкой его выбрать нельзя, он включится сам, когда домен подтвердится. Первый рабочий адрес становится основным. Адреса на бесплатной почте (gmail.com, mail.ru и подобных) добавить нельзя: такой домен не добавить в «Домены».
curl https://v1.estismail.com/mailer/senderemails.json \
-H "X-Estis-Auth: ВАШ_КЛЮЧ" \
-d name="Магазин" -d email=news@shop.example.com<?php
$ch = curl_init('https://v1.estismail.com/mailer/senderemails.json');
curl_setopt_array($ch, [
CURLOPT_POSTFIELDS => http_build_query([
'name' => 'Магазин',
'email' => 'news@shop.example.com',
]),
CURLOPT_HTTPHEADER => ['X-Estis-Auth: ВАШ_КЛЮЧ'],
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $response;import requests
r = requests.post(
"https://v1.estismail.com/mailer/senderemails.json",
headers={"X-Estis-Auth": "ВАШ_КЛЮЧ"},
data={
"name": "Магазин",
"email": "news@shop.example.com",
},
)
print(r.status_code, r.text)const res = await fetch("https://v1.estismail.com/mailer/senderemails.json", {
method: "POST",
headers: { "X-Estis-Auth": "ВАШ_КЛЮЧ" },
body: new URLSearchParams({
name: "Магазин",
email: "news@shop.example.com",
}),
});
console.log(res.status, await res.text());{"id":5502}PUT/mailer/senderemails/{id}.json
Изменить имя, сделать основным
| Параметр | Значение |
|---|---|
name | Новое имя отправителя. |
default=1 | Сделать адрес основным. Адрес должен быть рабочим (approved 1). |
curl -X PUT https://v1.estismail.com/mailer/senderemails/5502.json \
-H "X-Estis-Auth: ВАШ_КЛЮЧ" \
-d default=1<?php
$ch = curl_init('https://v1.estismail.com/mailer/senderemails/5502.json');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_POSTFIELDS => http_build_query([
'default' => '1',
]),
CURLOPT_HTTPHEADER => ['X-Estis-Auth: ВАШ_КЛЮЧ'],
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $response;import requests
r = requests.put(
"https://v1.estismail.com/mailer/senderemails/5502.json",
headers={"X-Estis-Auth": "ВАШ_КЛЮЧ"},
data={
"default": "1",
},
)
print(r.status_code, r.text)const res = await fetch("https://v1.estismail.com/mailer/senderemails/5502.json", {
method: "PUT",
headers: { "X-Estis-Auth": "ВАШ_КЛЮЧ" },
body: new URLSearchParams({
default: "1",
}),
});
console.log(res.status, await res.text());Ответ 204, без тела
DELETE/mailer/senderemails/{id}.json
Удалить адрес
Основной адрес удалить нельзя, сначала назначьте другой. Домен адреса остаётся.
curl -X DELETE https://v1.estismail.com/mailer/senderemails/5502.json \
-H "X-Estis-Auth: ВАШ_КЛЮЧ"<?php
$ch = curl_init('https://v1.estismail.com/mailer/senderemails/5502.json');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => ['X-Estis-Auth: ВАШ_КЛЮЧ'],
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $response;import requests
r = requests.delete(
"https://v1.estismail.com/mailer/senderemails/5502.json",
headers={"X-Estis-Auth": "ВАШ_КЛЮЧ"},
)
print(r.status_code, r.text)const res = await fetch("https://v1.estismail.com/mailer/senderemails/5502.json", {
method: "DELETE",
headers: { "X-Estis-Auth": "ВАШ_КЛЮЧ" },
});
console.log(res.status, await res.text());Ответ 204, без тела
Вопросы по API: support@estismail.com