imap_storage.storage.email package¶
Submodules¶
imap_storage.storage.email.address module¶
Address class
imap_storage.storage.email.body module¶
Body class
-
class
imap_storage.storage.email.body.
Body
(xml_str)[source]¶ Bases:
object
This class represents the Email body without physical attachments
-
add_item
(tag, text=None, attribs=None, parent=None)[source]¶ Add new Child to body or some other parent :param tag: Tag name of the new item :param text: Text content of the new item :param attribs: Dictionary!!! {‘attribname’: ‘attribvalue’} :returns: reference to new item
-
imap_storage.storage.email.email module¶
Email and Attachment class
-
class
imap_storage.storage.email.email.
Email
(directory, uid)[source]¶ Bases:
object
Emails as data storage interface :param imap: Imap connection :param uid: new object if None - make sure to run new method
-
add_file
(file_obj)[source]¶ add file to email :param file_obj: Object of class storage.file.File :returns: success bool
-
body
¶ access to the body object, fetch if not already done
-
fetch_payloads
()[source]¶ fetch payloads of this email
Returns: self.files with appended payloads Return type: list
-
file_by_id
(id_)[source]¶ get file by id Id is saved in the body (xml)
Parameters: id (str) – id of the file to get Returns: object Return type: File
-
file_by_name
(name)[source]¶ get file by name
Parameters: name (str) – of the file to get Returns: object Return type: File
-
files
¶ access to the file objects, fetch if not already done
-
head
¶ access to the head object, fetch if not already done
-
html
¶ get the whole email with files as html
-
name
¶ name of the email :returns: name :rtype: str
-
new_head
(subject, from_addr_obj, to_addr_obj)[source]¶ Create new message and save it :param subject: subject as string :param from_addr_obj: from-address as Address Object :param to_addr_obj: to-address as Address Object :returns: self
-
path
¶ path of the email
Returns: directory path/uid Return type: str
-
plain
¶ get the whole email with files as plain text
-
remove_file
(file)[source]¶ removes file object from email
Parameters: file (File) – File object to delete from email
-
remove_file_by_attrib
(attrib, value)[source]¶ remove file from email eg. remove_file_by_attrib(‘id’, ‘ldsKLfds’) :param attrib: attribute to select :param value: value of the attribute
-
subject
¶ subject of the email It is a cached value and fetches one time when accessing the property
Returns: subject Return type: str
-
to_string
(html=False)[source]¶ https://stackoverflow.com/a/43157340 mixed |—alternative | |—text | |—related | |—html | |—inline image | |—inline image |—attachment |—attachment
-
xml_files
¶ list of files that are registered in xml body
Type: returns
-
imap_storage.storage.email.file module¶
File class
-
imap_storage.storage.email.file.
file_from_local
(path)[source]¶ create File object from local path :param path: Of the local file
-
imap_storage.storage.email.file.
file_from_upload
(uploaded_file)[source]¶ create File object from Django uploaded file
imap_storage.storage.email.head module¶
Head class