New Wiki Entry - How to do HTML Email with Attachments

18 views
Skip to first unread message

Brian M

unread,
Jul 19, 2009, 6:30:09 PM7/19/09
to web2py-users
I've been trying to work out how to send rich emails using web2py and
think that I have come up with a workable solution.

Features:
* Message body in both plain text and HTML
* Ability to attach files to message
* Images are attached so they can be embedded in the HTML
message
* Non-Image files are regular attachments
* Ability to include CC and BCC recipients
* Ability to specify a Reply-To address
* Ability to spedify whether or not to use TLS when connecting to
SMTP server
* Should work with Google App Engine (GAE) but I haven't tested
it.

I've implemented it as an additional class in gluon/tools.py but you
could probably include it in a separate module if desired. It is based
off of the original Mail() class but is not 100% compatible, so you
can't simply replace Mail() with my new MultiPart_Mail() class.

A wiki entry with full usage example has been created at:

https://mdp.cti.depaul.edu/wiki/default/page/98b7448f-059a-47f7-82da-dce4728aa4dd

Suggestions are welcome!

~Brian
Reply all
Reply to author
Forward
0 new messages