extract_msg.attachments.signed_att Module
Module contents
- class extract_msg.attachments.signed_att.SignedAttachment(msg, data: bytes, name: str, mimetype: str, node: Message)[source]
Bases:
object
- Parameters:
msg – The MSGFile instance this attachment is associated with.
data – The bytes that compose this attachment.
name – The reported name of the attachment.
mimetype – The reported mimetype of the attachment.
node – The email Message instance for this node.
- save(**kwargs) Tuple[SaveType, List[str] | str | None] [source]
Saves the attachment data.
The name of the file is determined by several factors. The first thing that is checked is if you have provided :param customFilename: to this function. If you have, that is the name that will be used. Otherwise, the name from
name
will be used. After the name to use has been determined, it will then be shortened to make sure that it is not more than the value of :param maxNameLength:.To change the directory that the attachment is saved to, set the value of :param customPath: when calling this function. The default save directory is the working directory.
If you want to save the contents into a
ZipFile
or similar object, either pass a path to where you want to create one or pass an instance to :param zip:. If :param zip: is an instance, :param customPath: will refer to a location inside the zip file.
- saveEmbededMessage(**kwargs) Tuple[SaveType, List[str] | str | None] [source]
Seperate function from save to allow it to easily be overridden by a subclass.
- property asBytes: bytes
- property dataType: Type[type] | None
The class that the data type will use, if it can be retrieved.
This is a safe way to do type checking on data before knowing if it will raise an exception. Returns
None
if no data will be returns or if an exception will be raised.
- property emailMessage: Message
The email Message instance that is the source for this attachment.
- property mimetype: str
The reported mimetype of the attachment.
- property msg: MSGFile
The
MSGFile
instance this attachment belongs to.- Raises:
ReferenceError – The associated
MSGFile
instance has been garbage collected.
- property name: str
The reported name of this attachment.
- property longFilename: str
The reported name of this attachment.
- property shortFilename: str
The reported name of this attachment.
- property treePath: List[weakref]
A path, as a tuple of instances, needed to get to this instance through the MSGFile-Attachment tree.
- property type: AttachmentType