email_lib Package

email_lib Package

webnotes.utils.email_lib.get_contact_list()[source]

Returns contacts (from autosuggest)

Returns combination of footer from globals and Control Panel

webnotes.utils.email_lib.make_html_body(content, template=None)[source]

Generate html content from a Page Template object

webnotes.utils.email_lib.send_form()[source]

Emails a print format (form) Called from form UI

webnotes.utils.email_lib.sendmail(recipients, sender='', msg='', subject='[No Subject]', parts=[], cc=[], attach=[], send_now=1, reply_to=None, template=None)[source]

send an html email as multipart with attachments and all

webnotes.utils.email_lib.sendmail_html(sender, recipients, subject, html, text=None, template=None, send_now=1, reply_to=None)[source]

Send an html mail with alternative text and using Page Templates

form_email Module

class webnotes.utils.email_lib.form_email.FormEmail[source]

Represents an email sent from a Form

build_message()[source]

Builds the message object

Returns publicly accessible form link

Adds server name the relative links, so that images etc can be seen correctly

send()[source]

Send the form with html attachment

set_attachments()[source]

Set attachments to the email from the form

update_contacts()[source]

Add new email contact to database

html2text Module

html2text: Turn HTML into equivalent Markdown-structured text.

webnotes.utils.email_lib.html2text.charref(name)[source]
webnotes.utils.email_lib.html2text.entityref(c)[source]
webnotes.utils.email_lib.html2text.has_key(x, y)[source]
webnotes.utils.email_lib.html2text.hn(tag)[source]
webnotes.utils.email_lib.html2text.html2text(html, baseurl='')[source]
webnotes.utils.email_lib.html2text.html2text_file(html, out=<function wrapwrite at 0x38ff030>, baseurl='')[source]
webnotes.utils.email_lib.html2text.name2cp(k)[source]
webnotes.utils.email_lib.html2text.onlywhite(line)[source]

Return true if the line does only consist of whitespace characters.

webnotes.utils.email_lib.html2text.optwrap(text)[source]

Wrap all paragraphs in the provided text.

webnotes.utils.email_lib.html2text.replaceEntities(s)[source]
webnotes.utils.email_lib.html2text.unescape(s)[source]
webnotes.utils.email_lib.html2text.wrapwrite(text)[source]

receive Module

This module contains classes for managing incoming emails

class webnotes.utils.email_lib.receive.IncomingMail(content)[source]

Single incoming email object. Extracts, text / html and attachments from the email

get_attachment(part, charset)[source]

Extracts an attachment

get_charset(part)[source]

Guesses character set

get_payload(part, charset)[source]

get utf-8 encoded part content

get_text_content()[source]

Returns the text parts of the email. If None, then HTML parts

get_thread_id()[source]

Extracts thread id of the message between first [] from the subject

parse()[source]

Extracts text, html and attachments from the mail

process_part(part)[source]

Process a single part of an email

class webnotes.utils.email_lib.receive.POP3Mailbox(settings_doc)[source]

A simple pop3 mailbox, abstracts connection and mail extraction To use, subclass it and override method process_message(from, subject, text, thread_id)

check_mails()[source]

To be overridden If mailbox is to be scanned, returns true

connect()[source]

Connects to the mailbox

get_messages()[source]

Loads messages from the mailbox and calls process_message for each message

process_message(mail)[source]

To be overriden

send Module

Sends email via outgoing server specified in “Control Panel” Allows easy adding of Attachments of “File” objects

class webnotes.utils.email_lib.send.EMail(sender='', recipients=[], subject='', from_defs=0, alternative=0, reply_to=None)[source]

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

add_attachment(fname, fcontent, content_type=None)[source]
add_to_queue()[source]
attach_file(n)[source]

attach a file from the FileData table

make_msg()[source]
send(send_now=0)[source]

send the message

set_html(message)[source]

Attach message in the html portion of multipart/alternative

set_message(message, mime_type='text/html', as_attachment=0, filename='attachment.html')[source]

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

set_text(message)[source]

Attach message in the text portion of multipart/alternative

setup()[source]

setup the SMTP (outgoing) server from Control Panel or defs.py

validate()[source]

validate the email ids

class webnotes.utils.email_lib.send.EmailQueue[source]
close()[source]
flush(qty=100)[source]
get_smtp_session(e)[source]
push(email)[source]

Table Of Contents

This Page