Attachment object.
An Attachment object is largely interchangeable with a (filename, payload)
tuple.
Note that the behavior is a bit asymmetric with respect to unpacking and
equality comparison. An Attachment object without a content ID will be
equivalent to a (filename, payload) tuple. An Attachment with a content ID
will unpack to a (filename, payload) tuple, but will compare unequally to
that tuple.
Thus, the following comparison will succeed:
attachment = mail.Attachment('foo.jpg', 'data')
filename, payload = attachment
attachment == filename, payload
...while the following will fail:
attachment = mail.Attachment('foo.jpg', 'data', content_id='<foo>')
filename, payload = attachment
attachment == filename, payload
The following comparison will pass though:
attachment = mail.Attachment('foo.jpg', 'data', content_id='<foo>')
attachment == (attachment.filename,
attachment.payload,
attachment.content_id)
Attributes:
filename: The name of the attachment.
payload: The attachment data.
content_id: Optional. The content-id for this attachment. Keyword-only.