Mail

Mail object

class janua.utils.mail.MailObj[source]

Mail object which are passed to mail queue (see janua.utils.sqlite_queue.PersistentSqliteQueue).

Note

If template attribute is defined, message and subject will be ignored

Example to send an email:

from janua import mail_queue
from janua.utils.mail import MailObj, MailError
from janua.utils.logger import getLogger

log = getLogger(__name__)

try:
    mailobj = MailObj()
    mailobj.message = "Where are you ?"
    mailobj.subject = "John"
    mailobj.to = "john.doe@nothing.here"
    mailobj.reply_to = "admin@nothing.here"
    mailobj.bcc = ["admin@nothing.here"]
except MailError, err:
    log.error('Cannot instanciate mail object')

mail_queue.put(mailobj)
message

Mail body

subject

Mail subject

to

Mail recipients

template

Mail template

template_args

Mail template arguements

reply_to

Mail reply to recipient

bcc

Mail blind carbon copy

Email validation

janua.utils.mail.valid_email(address)[source]

Check validity of email address

Parameters:address – mail address to validate
Returns:True if valid, False otherwise