You can use the web2py template language to generate emails.

from gluon.template import parse_template
from gluon.tool import Mail

mail=Mail
mail.settings.server='smtp.gmail.com:
587'
mail.settings.sender='y...@somewhere.com'
mail.settings.login=None or
'username:password'

path=os.path.join(request.folder,"views")
context=dict(a=1,b=2,c=3,etc="etc")
message=parse_template('file.html',path=path,context=context)
mail.send(to=['y...@whatever.com'],subject='None',message=message)

Massimo


On May 27, 4:28 am, Carl <carl.ro...@gmail.com> wrote:
> web2py's templating for HTML pages makes managing page structure
> populated with dynamic content very straightforward and scalable.
>
> What approach is recommended to use this power to manage emails/email
> templates?
>
> My application sends out emails populated with a lot of dynamic data
> and before I compose a String for the body text in Python I wondered
> if the existing template engine could be harnessed (and if so, what's
> the recommended way to leverage it)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to