API Summary¶
Grab¶
pymmails.EmailMessage
(self, policy = Compat32())
overloads the message to class to add some functionalities such as a display using HTML
as_bytes
(self)converts the mail into a binary string
as_string
(self, unixfrom = False, maxheaderlen = None, policy = None)Converts the mail into a string.
call_decode_header
(st, is_email = False)Creates an instance of
EmailMessage
from a binary string (bytes) (seeas_bytes
).
decode_header
(self, field, st)decode a string encoded in the header
default_filename
(self)define a default filename (no extension)
dump
(self, render, location, attach_folder = ‘attachments’, fLOG = <function noLOG at 0x7fd6c5f6bdc0>, params)Dumps a message using a call such as
EmailMessageRenderer
.
dump_attachments
(self, attach_folder = ‘.’, buffer_write = None, metadata = True, fLOG = <function noLOG at 0x7fd6c5f6bdc0>)Dumps the mail into a folder using HTML format. If the destination files already exists, it skips it. If an attachments already has the same name, it chooses another one if the attachment is different (otherwise it keeps it as it is).
enumerate_attachments
(self)enumerate the attachments as 4-uple (filename, content, message_id, content_id)
get_all_charsets
(self, part = None)returns all the charsets
get_date
(self)return a datetime object for the field Date
get_date_str
(self)return the date into a string
get_field
(self, field)get a field and cleans it
get_from
(self)returns a tuple (label, email address) or a list of groups from the regular expression
get_from_str
(self)return a string for the receivers
get_name
(self, _fallback_get_from = True)return the sender name of an email (if available)
get_nb_attachements
(self)return the number of attachments
get_to
(self, cc = False, field = ‘to’)return the receivers
get_to_str
(self, cc = False, field = ‘to’)return a string for the receivers
interpret_default_filename
(name)reverse engineer method
default_filename
read_metadata
(metafile)read metadata assuming metafile contaings a json string
to_dict
(self)Returns all fields for an emails as a dictionary
pymmails.MailBoxImap
(self, user, pwd, server, ssl = False, fLOG = <function noLOG at 0x7fd6c5f6bdc0>)
Defines a mail box with :epkg:`IMAP` interface.
enumerate_mails_in_folder
(self, folder, skip_function = None, date = None, pattern = ‘ALL’, body = True)Enumerates all mails in folder folder.
enumerate_search_person
(self, person, folder, skip_function = None, date = None, max_dest = 5, body = True)Enumerates all mails in folder folder from a user or sent to a user.
enumerate_search_subject
(self, subject, folder, skip_function = None, date = None, max_dest = 5)Enumerates all mails in folder folder with a subject verifying a regular expression.
folders
(self)Returns the list of folder of the mail box.
login
(self)login
logout
(self)logout
pymmails.grabber.pop_helper.retrieve_mails_pop
(user, password, server, begin = 0, end = -1, fLOG = <function noLOG at 0x7fd6c5f6bdc0>)
retrieves all emails using POP service
Helpers¶
pymmails.helpers.iterator_prev_next
(iter)
iterator on a sequence and returns another iterator with
previous item, current item, next item
,
Rendering¶
pymmails.render.renderer.Renderer
(self, tmpl, css, style_table = ‘dataframe100l’, style_highlight = ‘dataframe100l_hl’, buffer_write = None, fLOG = <function noLOG at 0x7fd6c5f6bdc0>)
defines way to render an email
Send¶
pymmails.compose_email
(fr, to, subject, body_html = None, body_text = None, attachements = None, cc = None, bcc = None)
Composes an email as a string.