Part of bzrlib.email_message View In Hierarchy
The constructor needs an origin address, a destination address or addresses and a subject, and accepts a body as well. Add additional parts to the message with add_inline_attachment(). Retrieve the entire formatted message with as_string().
Headers can be accessed with get() and msg[], and modified with msg[] =.
| Method | __init__ | Create an email message. |
| Method | add_inline_attachment | Add an inline attachment to the message. |
| Method | as_string | Return the entire formatted message as a string. |
| Method | get | Get a header from the message, returning failobj if not present. |
| Method | __getitem__ | Get a header from the message, returning None if not present. |
| Method | __setitem__ | Undocumented |
| Static Method | send | Create an email message and send it with SMTPConnection. |
| Static Method | address_to_encoded_header | RFC2047-encode an address if necessary. |
| Static Method | string_with_encoding | Return a str object together with an encoding. |
All four parameters can be unicode strings or byte strings, but for the addresses and subject byte strings must be encoded in UTF-8. For the body any byte string will be accepted; if it's not ASCII or UTF-8, it'll be sent with charset=8-bit.
| Parameters | from_address | The origin address, to be put on the From header. |
| to_address | The destination address of the message, to be put in the To header. Can also be a list of addresses. | |
| subject | The subject of the message. | |
| body | If given, the body of the message. |
The attachment body will be displayed inline, so do not use this function to attach binary attachments.
| Parameters | body | A text to attach. Can be an unicode string or a byte string, and it'll be sent as ascii, utf-8, or 8-bit, in that preferred order. |
| filename | The name for the attachment. This will give a default name for email programs to save the attachment. | |
| mime_subtype | MIME subtype of the attachment (eg. 'plain' for text/plain [default]). |
| Parameters | boundary | The boundary to use between MIME parts, if applicable. Used for tests. |
This method intentionally does not raise KeyError to mimic the behavior of __getitem__ in email.Message.
See EmailMessage.__init__() and EmailMessage.add_inline_attachment() for an explanation of the rest of parameters.
| Parameters | config | config object to pass to SMTPConnection constructor. |