Envelope for holding message data along with
- class slimta.envelope.Envelope([sender=None[, recipients=None[, headers=None[, message=None]]]])¶
Class containing message data and metadata. This class acts like an envelope with the sending address, recipient(s), and the actual message.
Sending address of the message.
List of recipient addresses of the message.
Bytestring of message data, not including headers.
Dictionary of information about the client that sent the message. Utilized keys include:
ip: The IP of the client.
host: The reverse-lookup of the client IP.
name: The client name, as given by its
protocol: The protocol used by the client, generally a variant
auth: The name the client successfully authenticated with, or
Timestamp when the message was received.
- prepend_header(name, value)¶
This method allows prepending a header to the message.
This method uses undocumented Python API because the
headersobject does not directly support header prepending.
name – The header name.
value – The header value string.
Builds and returns an exact copy if the current object. This method uses a deep-copying so internal datastructures are not shared.
new_rcpts – If given, overwrite the
recipientslist with this value in the new object.
An exact, deep copy of the current object.
Produces two strings representing the headers and message body.
Tuple of two bytestrings:
New in version 0.3.12.
Forces the message into 7-bit encoding such that it can be sent to SMTP servers that do not support the
encoderfunction is not given, this function is relatively cheap and will just check the message body for 8-bit characters (raising
UnicodeDecodeErrorif any are found). Otherwise, this method can be very expensive. It will parse the entire message into MIME parts in order to encode parts that are not 7-bit.
encoder – Optional function from
email.encodersused to encode MIME parts that are not 7-bit.
Message) – The complete message, headers and message body.