Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending email from an web2py on GAE

I am trying to send a mail from my web2py app hosted on GoogleAppEngine. But it is not working. I used the mail function that was given with the web2py. Does anybody how to do this? I read in the GAE Documentation that python mail library would not work with GAE and GAE mail library has to be used. Does it also applies to web2py mail? Thanks

like image 737
felix Avatar asked Apr 16 '10 20:04

felix


1 Answers

The web2py gluon.tools.Mail class (that is used by the Auth module too) works on GAE and non-GAE out of the box. You just need to pass the correct settings:

mail=Mail()
mail.settings.server="smtp.example.com:25" or "gae"
mail.settings.sender="[email protected]"
mail.settings.tls=True or False
mail.settings.login="you:password"

It supports multiple encodings, MIME and attachments.

like image 129
mdipierro Avatar answered Sep 26 '22 05:09

mdipierro