Accepts a message as a request instead of a mail session: recipients, substitution data and content arrive in one JSON.
The call is POST https://address:port/api/v1/transmissions to the <transmissions-api-listener> listener — only over HTTPS, so the listener needs a certificate. The header is Content-Type: application/json, and the key goes in the Authorization header; the body can be compressed by declaring Content-Encoding: gzip.
The keys are its own, not the monitor key: they are listed with api-key lines in <transmissions-api>, from 32 to 128 characters. Source properties for messages submitted this way are set by the named source {transmissions-api}.
A 200 response carries a count: how many recipients were accepted and how many rejected. Errors come as codes 400, 403, 404, 405 and 500.
What the response means:
| Code | When |
|---|---|
| 200 | the request is accepted; how many recipients were accepted and rejected is in the body |
| 400 | format error: a required field is missing, wrong type, an unsupported SparkPost field |
| 403 | no Authorization header or the key is wrong |
| 404 | wrong path |
| 405 | the method is not POST |
| 500 | internal error while parsing a valid request |
# submit a message with a request: the key from <transmissions-api> curl -s -X POST --insecure -H 'Content-Type: application/json' -H 'Authorization: KEY' --data @msg.json 'https://127.0.0.1:8585/api/v1/transmissions'
2 relations
Personalization inside the engineThe mechanism that is visible here. § 8.1.4
grep -n -A4 '<transmissions-api' /etc/pmta/config
curl -s -o /dev/null -w "%{http_code}\n" --insecure -X POST 'https://127.0.0.1:8585/api/v1/transmissions'
3 articles
◇Personalization inside the engineVariables are set per recipient, and the node substitutes them at delivery — one submitted message goes to many recipients with different content.◇Mail merge via SMTP extensionsMail merge over SMTP: XMRG instead of MAIL FROM, XDFN with variables before each recipient, and XPRT instead of DATA for each part.◇How a message gets into the engineSix described submission methods: extended SMTP, four language bindings and a directory the node watches on disk.