Knowledge base

Encodings at submission

submission data encoding
Three modes for added data

Encoding in a binding is a mode that applies to all data added after it is selected: 7-bit, 8-bit or base64. The default is 7-bit.

7-bit and 8-bit do not change the data, except for one thing: a lone LF line feed turns into a CRLF pair. With 7-bit, making sure the high bit of every byte is cleared is the submitter’s job.

base64 encodes on the fly everything added, so it also suits binary content — if the submitter sets the appropriate MIME headers matching Content-Transfer-Encoding.

Mail merge and base64 are incompatible: merge data supports only 7-bit and 8-bit.

The main trap is taking a difference in submission paths for a difference in messages. The binding silently converts a lone LF to CRLF, while for SMTP submission the manual calls a lone LF the most common error: a program can work through a binding and fail on SMTP.
What the Hub does. Not used: the Hub submits finished messages over SMTP.
Recommended values

Three modes:

Mode What it does with the data
PmtaMsgENCODING_7BIT nothing except LF to CRLF; the high bit is the submitter’s job; the default
PmtaMsgENCODING_8BIT nothing except LF to CRLF
PmtaMsgENCODING_BASE64 encodes on the fly; not suitable for merge
The three encodings, LF conversion, the default and the merge restriction come from the manual (§ 7.4.10, § 7.4.14); the most common SMTP submission error is § 4.2.4. The conclusion about the difference in submission paths is ours.
Example configuration
# a binary attachment: base64 with a matching MIME header
msg.setEncoding(PmtaMsgENCODING_BASE64);
The mode applies to everything added after the call, so the order of calls decides how each part is encoded.
yellow — — directive names, blue — blocks. They are highlighted the same way in the text of the card.
Compatibility
PowerMTA 6.0
described in the manual of this version · platform: any
The vendor does not state the first version for every directive — there is no note here. The name also appears in the 5.0 edition of the manual.
How to check on the node
Find the encoding modes in the binding headers:
grep -rn 'PmtaMsgENCODING' /opt/pmta/api/include/ | head
The three enumeration values are those very modes.
In the Hub
Cost of a mistake
safe: a wrong value breaks nothing
Scenarios
Connect a sending platform