Sending email from web2py to GAE

I am trying to send mail from my web2py application hosted on GoogleAppEngine. But that does not work. I used the mail function that was passed using web2py. Anyone how to do this? I read in the GAE documentation that the python mail library will not work with GAE and the GAE mail library should be used. Does this also apply to web2py mail? Thanks

+5
source share
3 answers

The web2py gluon.tools.Mail class (which is also used by the Auth module) works with GAE and without 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="you@example.com"
mail.settings.tls=True or False
mail.settings.login="you:password"

It supports multiple encodings, MIME and attachments.

+5

web2py gluon.tools.Mail GAE. . gluon.tools 310

    try:
        if self.settings.server == 'gae':
            from google.appengine.api import mail
            result = mail.send_mail(sender=self.settings.sender, to=to,
                                    subject=subject, body=text)

GAE

mail=Mail()
mail.settings.server="gae"
mail.settings.sender="you@example.com" #This must be the email address of a registered
                                       #administrator for the application, or the address 
                                       #of the current signed-in user. 
mail.settings.login="you:password"

http://code.google.com/intl/en/appengine/docs/python/mail/emailmessagefields.html    , From. . . API- .

! . .

(celso.gcosta@gmail.com) 2010

+3

You must use your own App Engine email program: http://code.google.com/appengine/docs/python/mail/sendingmail.html

-1
source

All Articles