简体   繁体   中英

Sending mail python webapp2 GAE

I initially tried using the smptlib library but in order to send an e-mail I need to use SSL which costs me with Google App Engine. Other than that, smtplib was a perfect solution.

I found a link here which explains how to send an email using the GAE API.

However, I can't seem to figure out how one would log in to a gmail account say, in order to send the email.

The purpose of this is to send a verification email to addresses of those who are registering. But in the link it shows how to get the current_user and send the email using their credentials. How would I explicitly enter an email, password, and smtp server like I would do with smtplib in order to send the email from my desired address.

Thanks for any answers!

You can't send from an arbitrary email address. As the overview docs state, you can only send from:

  • The Gmail or Google Apps Account of the user who is currently signed in
  • Any email address of the form anything@appname.appspotmail.com or anything@appalias.appspotmail.com
  • Any email address listed in Email API Authorized Senders found in the App Engine Settings page of the Developers Console

If you are the owner of the email account you want to send from, and it is a GMail account, you can add it to the Email API Authorized Senders list from the App Engine console.

Once that's done, you can just use it as the sender address - you don't need to log into anything.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM