In slimta, an email message is thought of like a ‘snail mail’ envelope, it’s
not just the message contents but also sending and receiving addresses and other
logistical information. An
Envelope object represents all of this information.
Headers and Contents¶
The headers and body of the email contents are split up into the
message attributes. The
email.message.Message object and can be used to view, add, and
delete headers only, it does not contain the message payload as described by
Message documentation. The
message attribute of the
Envelope object is Python string containing the contents of the message,
everything after the headers.
For delivery, slimta
Relay transports will call
flatten() to convert the
headers (with any
message into a single string. After flattening, the
message headers portion of the generated string is guaranteed to use
Non-Delivery Reports (Bounces)¶
Because a client that sent a message to an edge service will disconnect once the message has been queued, there is no way of reporting to the client that the message was delivered (successfully or unsuccessfully).
As such, the message sender should assume that a message was delivered successfully unless told otherwise. If slimta failed to deliver a message, either because of too many delivery attempts or a permanent error, it will generate and deliver a bounce message back to the original sender address of the message. From this bounce message, the sender should be able to tell which message failed and why.
Generating Bounce Messages¶
Bounce class allows for customization of the format of this bounce
message. The static class member
sender is the
sender address to use. Bounce messages are not “from” anyone, and thus the
(RFC mandated) default is an empty string (
Bounce class is a sub-class of
Envelope and can thus be used wherever a
Envelope is required. The
Bounce message is generated using the
original message’s flattened message data surrounded by the header and footer
templates given in the
Bounce class’s static
footer_template members. See the API documentation
of these attributes for information on how they work.