GMail API - Can I send email using the Service Account?

强颜欢笑 提交于 2019-11-29 10:49:22

No. The Gmail API is for Gmail users and service accounts are just for doing auth to a real Gmail account, they don't have their own Gmail account, etc.

If you want to send the email from some service, you need some bulk-sending email service like at: https://cloud.google.com/compute/docs/tutorials/sending-mail/ or something you run yourself or from some other provider.

Contrary to what the other answers say (with the utmost respect), you can send emails via a service account - I've done so myself from a paid Google account.. In other words, you can use a service account to send emails programmatically from your personal email account: e.g. washinton.irving@gmail.com. I thought to add this answer to reflect this reality; The link which explains it all can be found below:

https://medium.com/lyfepedia/sending-emails-with-gmail-api-and-python-49474e32c81f

Here is a summary contained within the above tutorial:

  1. Turn on the Gmail API and create a service account with domain-wide authority.
  2. Authorize the service account to send emails.
  3. Send emails with a Python/Ruby etc. script.

The link above shows it all in detail and I hope that helps.

Another alternative:

You can create a separate password that your app uses to access your gmail account. You'll have to go into your gmail settings, and create a password which a particular app can use.

No, what you are looking for is a bulk email sending service. Checkout sendgrid , Amazon AWS SES, mandrill or if you want to stick with Google, this. You could of course run your own postfix server (although I'm assuming you were using gmail api for deliverability in the first place.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!