Package pyzmail :: Module parse :: Class MailPart
[hide private]
[frames] | no frames]

Class MailPart

source code

Data related to a mail part (aka message content, attachment or embedded content in an email)

Instance Methods [hide private]
 
__init__(self, part, filename=None, type=None, charset=None, content_id=None, description=None, disposition=None, sanitized_filename=None, is_body=None)
Create an mail part and initialize all attributes
source code
 
get_payload(self)
decode and return part payload.
source code
 
__repr__(self) source code
Instance Variables [hide private]
str or None charset
the encoding of the get_payload() content if type is 'text/*' and charset has been specified in the message
str or None content_id
the MIME Content-ID if specified in the message.
str or None description
the MIME Content-Description if specified in the message.
str or None disposition
None, 'inline' or 'attachment' depending the MIME Content-Disposition value
unicode or None filename
the name of the file, if specified in the message.
str or None is_body
None if this part is not the mail content itself (an attachment or embedded content), 'text/plain' if this part is the text content or 'text/html' if this part is the HTML version.
inherit from email.mime.base.MIMEBase part
the related part inside the message.
str or None sanitized_filename
This field is filled by PyzMessage to store a valid unique filename related or not with the original filename.
str type
the MIME type, like 'text/plain', 'image/png', 'application/msword' ...
Method Details [hide private]

get_payload(self)

source code 

decode and return part payload. if type is 'text/*' and charset not None, be careful to take care of the text encoding. Use something like part.get_payload().decode(part.charset)