module render.email_message_list_renderer
¶
Short summary¶
module pymmails.render.email_message_list_renderer
Functions to dump emails
Classes¶
class |
truncated documentation |
---|---|
Defines a way to render a list of emails with a template template based on Jinja2. … |
Properties¶
property |
truncated documentation |
---|---|
|
returns |
Methods¶
method |
truncated documentation |
---|---|
Renders a mail. |
|
Writes a list of mails in a folder and writes a summary. |
Documentation¶
@file @brief Functions to dump emails
- class pymmails.render.email_message_list_renderer.EmailMessageListRenderer(title, email_renderer, tmpl_begin=None, tmpl_iter=None, tmpl_end=None, css=None, style_table='dataframe100l', style_highlight='dataframe100l_hl', buffer_write=None, fLOG=<function noLOG>)¶
Bases:
Renderer
Defines a way to render a list of emails with a template template based on Jinja2.
Render a list of emails
The following example extracts all mails in a folder of a gmail inbox, dumps them in a folder and produces a summary which connects to them.
from pymmails import EmailMessageRenderer, EmailMessageListRenderer, MailBoxImap box = MailBoxImap(user, pwd, server) box.login() mails = box.enumerate_mails_in_folder("<your_folder)") email_render = EmailMessageRenderer() render = EmailMessageListRenderer(title="list of mails", email_renderer=email_render) render.write(iter=mails, location=temp, filename="summary.html") box.logout()) render.flush()
@param title title @param email_renderer email renderer (see @see cl EmailMessageRenderer) @param tmpl_begin template which begins the summary @param tmpl_iter template which adds an element @param tmpl_end template which ends the summary @param css template style @param style_table style for the table @param style_highlight style for highlighted cells @param buffer_write instance of class @see cl BufferFilesWriting @param fLOG logging function
- __init__(title, email_renderer, tmpl_begin=None, tmpl_iter=None, tmpl_end=None, css=None, style_table='dataframe100l', style_highlight='dataframe100l_hl', buffer_write=None, fLOG=<function noLOG>)¶
@param title title @param email_renderer email renderer (see @see cl EmailMessageRenderer) @param tmpl_begin template which begins the summary @param tmpl_iter template which adds an element @param tmpl_end template which ends the summary @param css template style @param style_table style for the table @param style_highlight style for highlighted cells @param buffer_write instance of class @see cl BufferFilesWriting @param fLOG logging function
- render(location, iter, attachments=None, file_css='mail_style.css')¶
Renders a mail.
@paramp location location where this mail should be saved @param iter iterator on tuple (object, function to call to render the object) @param attachments used to produce a JSON list @param file_css css file (where it is supposed to be stored) @return html, css (content), attachements as JSON
The method populate fields
now
,message
,css
,render
,location
,title
.
- write(location, iter, filename, attachments=None, overwrite=False, file_css='mail_style.css', file_jsatt='_summaryattachements.json', encoding='utf8', attach_folder='attachments')¶
Writes a list of mails in a folder and writes a summary.
@param location location @param mail instance of @see cl EmailMessage @param attachments list of attachments (see @see me dump_attachments) @param overwrite the function does not overwrite @param file_css css file (where it is supposed to be stored) @param file_jsatt list of attachments in json format
[{'a': 'href', 'name': 'anchor', ...}, ...]
@param encoding encoding @param attach_folder attachments folder @return list of written local files
The method calls method
flush
.