extract_msg.recipient Module
Module contents
- class extract_msg.recipient.Recipient(_dir: str, msg: MSGFile, recipientTypeClass: Type[_RT])[source]
Bases:
Generic[_RT]Contains the data of one of the recipients in an MSG file.
- exists(filename: str | List[str] | Tuple[str]) bool[source]
Checks if stream exists inside the recipient folder.
- Raises:
ReferenceError – The associated
MSGFileinstance has been garbage collected.
- sExists(filename: str | List[str] | Tuple[str]) bool[source]
Checks if the string stream exists inside the recipient folder.
- Raises:
ReferenceError – The associated
MSGFileinstance has been garbage collected.
- existsTypedProperty(id, _type=None) Tuple[bool, int][source]
Determines if the stream with the provided id exists.
The return of this function is 2 values, the first being a boolean for if anything was found, and the second being how many were found.
- Raises:
ReferenceError – The associated
MSGFileinstance has been garbage collected.
- getMultipleBinary(filename: str | List[str] | Tuple[str]) List[bytes] | None[source]
Gets a multiple binary property as a list of bytes objects.
Like
getStringStream(), the 4 character type suffix should be omitted. So if you want the stream “__substg1.0_00011102” then the filename would simply be “__substg1.0_0001”.- Raises:
ReferenceError – The associated
MSGFileinstance has been garbage collected.
- getMultipleString(filename: str | List[str] | Tuple[str]) List[str] | None[source]
Gets a multiple string property as a list of str objects.
Like
getStringStream(), the 4 character type suffix should be omitted. So if you want the stream “__substg1.0_00011102” then the filename would simply be “__substg1.0_0001”.- Raises:
ReferenceError – The associated
MSGFileinstance has been garbage collected.
- getPropertyAs(propertyName: int | str, overrideClass: Type[_T] | Callable[[Any], _T]) _T | None[source]
Returns the property, setting the class if found.
- Parameters:
overrideClass – Class/function to use to morph the data that was read. The data will be the first argument to the class’s
__init__method or the function itself, if that is what is provided. If the value isNone, this function is not called. If you want it to be called regardless, you should handle the data directly.
- getPropertyVal(name: int | str, default: _T | None = None) Any | _T[source]
instance.props.getValue(name, default)Can be overridden to create new behavior.
- getSingleOrMultipleBinary(filename: str | List[str] | Tuple[str]) List[bytes] | bytes | None[source]
A combination of
getStringStream()andgetMultipleString().Checks to see if a single binary stream exists to return, otherwise tries to return the multiple binary stream of the same ID.
Like
getStringStream(), the 4 character type suffix should be omitted. So if you want the stream “__substg1.0_00010102” then the filename would simply be “__substg1.0_0001”.- Raises:
ReferenceError – The associated
MSGFileinstance has been garbage collected.
- getSingleOrMultipleString(filename: str | List[str] | Tuple[str]) str | List[str] | None[source]
A combination of
getStringStream()andgetMultipleString().Checks to see if a single string stream exists to return, otherwise tries to return the multiple string stream of the same ID.
Like
getStringStream(), the 4 character type suffix should be omitted. So if you want the stream “__substg1.0_0001001F” then the filename would simply be “__substg1.0_0001”.- Raises:
ReferenceError – The associated
MSGFileinstance has been garbage collected.
- getStream(filename: str | List[str] | Tuple[str]) bytes | None[source]
Gets a binary representation of the requested stream.
This should ALWAYS return a
bytesobject if it was found, otherwise returnsNone.- Raises:
ReferenceError – The associated
MSGFileinstance has been garbage collected.
- getStreamAs(streamID: str | List[str] | Tuple[str], overrideClass: Type[_T] | Callable[[Any], _T]) _T | None[source]
Returns the specified stream, modifying it to the specified class if it is found.
- Parameters:
overrideClass – Class/function to use to morph the data that was read. The data will be the first argument to the class’s
__init__method or the function itself, if that is what is provided. If the value isNone, this function is not called. If you want it to be called regardless, you should handle the data directly.
- getStringStream(filename: str | List[str] | Tuple[str]) str | None[source]
Gets a string representation of the requested stream.
Rather than the full filename, you should only feed this function the filename sans the type. So if the full name is “__substg1.0_001A001F”, the filename this function should receive should be “__substg1.0_001A”.
This should ALWAYS return a string if it was found, otherwise returns None.
- Raises:
ReferenceError – The associated
MSGFileinstance has been garbage collected.
- getStringStreamAs(streamID: str | List[str] | Tuple[str], overrideClass: Type[_T] | Callable[[Any], _T]) _T | None[source]
Returns the specified string stream, modifying it to the specified class if it is found.
- Parameters:
overrideClass – Class/function to use to morph the data that was read. The data will be the first argument to the class’s
__init__method or the function itself, if that is what is provided. If the value isNone, this function is not called. If you want it to be called regardless, you should handle the data directly.
- listDir(streams: bool = True, storages: bool = False) List[List[str]][source]
Lists the streams and or storages that exist in the recipient directory.
- Returns:
The paths excluding the recipient directory, allowing the paths to be directly used for accessing a file.
- slistDir(streams: bool = True, storages: bool = False) List[str][source]
Like
listDir(), except it returns the paths as strings.
- property account: str | None
The account of this recipient.
- property email: str | None
The recipient’s email.
- property entryID: PermanentEntryID | None
The recipient’s Entry ID.
- property formatted: str
The formatted recipient string.
- property instanceKey: bytes | None
The instance key of this recipient.
- property name: str | None
The recipient’s name.
- property props: PropertiesStore
The Properties instance of the recipient.
- property recordKey: bytes | None
The record key of this recipient.
- property searchKey: bytes | None
The search key of this recipient.
- property smtpAddress: str | None
The SMTP address of this recipient.
- property transmittableDisplayName: str | None
The transmittable display name of this recipient.
- property type: _RT
The recipient type.
- property typeFlags: int
The raw recipient type value and all the flags it includes.