Version 6.x.x Source

Class EMail

Wrapper on the email module. Email object represents emails to be sent to the client. Also provides a clean way to add binary FileData attachments Also sets all messages as multipart/alternative for cleaner reading in text-only clients

__init__ (self, sender=, recipients=(), subject=, alternative=0, reply_to=None, cc=())

No docs


add_attachment (self, fname, fcontent, content_type=None)

add attachment


add_pdf_attachment (self, name, html, options=None)

No docs


as_string (self)

validate, build message and convert to string


attach_file (self, n)

attach a file from the FileData table


get_default_sender (self)

No docs


make (self)

build into msg_root


set_html (self, message, text_content=None, footer=None, print_html=None, formatted=None)

Attach message in the html portion of multipart/alternative


set_html_as_text (self, html)

return html2text


set_message (self, message, mime_type=text/html, as_attachment=0, filename=attachment.html)

Append the message with MIME content to the root node (as attachment)


set_message_id (self, message_id)

No docs


set_part_html (self, message)

No docs


set_text (self, message)

Attach message in the text portion of multipart/alternative


validate (self)

validate the email ids



frappe.email.email_body.get_email (recipients, sender=, msg=, subject=[No Subject], text_content=None, footer=None, print_html=None, formatted=None, attachments=None, content=None, reply_to=None, cc=())

send an html email as multipart with attachments and all


frappe.email.email_body.get_footer (email_account, footer=None)

append a footer (signature)


frappe.email.email_body.get_formatted_html (subject, message, footer=None, print_html=None)

No docs


frappe.email.email_body.get_signature (email_account)

No docs