The only capability the manual explicitly calls an advantage of the bindings over regular SMTP.
How it works. Each recipient has its own set of named variables. The message body is added with two different actions: as verbatim data or as merge data — and in the second case the variables are substituted at delivery, by the engine, not by the submitting system.
Why separate the two kinds of data. One message can hold both what must not be touched and what is personalized: the signature, the unsubscribe link and legal text are added verbatim, while the greeting and content are added via merge.
The savings are real. One submitted message serves many recipients: the body is transferred to the node once and expanded by the number of addresses on the node itself. That is exactly why the manual says the bindings are faster than a regular connection only in this case.
Line breaks inside a variable are written as escape sequences. The manual distinguishes a real line break from a literal backslash in its examples — and this is not pedantry: a mistake produces either a broken layout or service characters visible to the recipient.
Numbered parts exist for multipart merges: the first is implied, and each number is used once.
In our setup personalization is done by the platform before submission: the message arrives at the node already assembled. This is deliberate — that way the content is visible in the preview and in the log before sending, rather than appearing at the last step inside the engine.
Merging would become interesting if the Hub itself sent large campaigns: then one transfer instead of a thousand would noticeably reduce traffic to the node. As long as submission is handled by the platforms, there is no gain.
What to add with what:
| Part of the message | Which action | Why |
|---|---|---|
| greeting, per-recipient content | merge data | this is what the mechanism exists for |
| legal text, signature | verbatim data | must not change for anyone |
| unsubscribe link | verbatim | all the more so if it has special characters |
| layout from a third-party editor | verbatim | it may contain something resembling a variable |
Check line breaks on a live message. An escape sequence and a literal backslash differ by one character, and the result is either a line break or characters visible to the recipient. This can be checked only by sending to yourself.
Merging also has to be allowed in the submission block (allow-mailmerge): without that the submitting system will not apply it.
# the recipient has its own variables, and one message is assembled # rcpt.defineVariable("name", "Maria") # msg.addMergeData("Hello, [name]!") # msg.addData("Best regards, the sales team")# the first body line will be substituted, the second will go out as is
what people get wrong and how it ends3 mistakes▶
§ 7.4.19
§ 7.4.19
§ 3.3.7
3 relations
allow-mailmerge<source>Permission on the node: without it the submitting system will not apply merging. § 7.1Reserved merge variable namesNames taken by the engine: your own variables must not be named that way. § 11.19.4.2Numbered merge partsNumbered parts of the same mechanism — for multipart merges. § 11.19.4.3
mailmerge-expands-undefined-variablesGlobalThe rule concerns only messages assembled by mail merge; it does not apply to ordinary substitutions. § 3.3.1.39Encodings at submissionA related mechanism: they work together. § 7.4.14Submission over HTTPS on its own listener, modeled on SparkPostThe message body is assembled with substitutions in the same style. § 8.1Submitting a message over HTTPThe mechanism that is visible here. § 8.1.4Six ways to choose a stream and the order among themMerging decides whether the choice applies to the whole job at once or to each recipient separately. § 9.4The merge variable is the top rung, and it lives in the contentIt exists only where merging is enabled, and for the same reason it acts per recipient. § 9.4
grep -n 'allow-mailmerge' /etc/pmta/config pmta show jobs
3 articles
◇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.◇Who is allowed to submit mail and for whom to accept itOut of the box, the node accepts submission only from the machine itself; two different questions — “who can send through us” and “for whose addresses we accept mail” — are answered by different directives.