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

后端 未结 3 851
温柔的废话
温柔的废话 2020-12-17 20:05

When I send an email using the GMail API, I get an Access Token for the user to whom the message is to be sent and then when sending the message, I put some value in the Fro

相关标签:
3条回答
  • 2020-12-17 20:16

    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.

    0 讨论(0)
  • 2020-12-17 20:20

    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.

    0 讨论(0)
  • 2020-12-17 20:32

    You cannot use a service account to impersonate a free gmail account. I spent a lot of time confirming this after reading a reply that was here before. Maybe it worked at some point, but it doesn't anymore.

    There is no way to share / grant another user permission to access your standard gmail account. So there is no way for you go delegate the permissions for bob@mycompany.com to access bob@gmail.com.

    and

    you can impersonate G-Suite accounts but not Gmail accounts

    These quotes are from Google's official C# Auth repo:
    https://github.com/googleapis/google-api-dotnet-client/issues/1561

    0 讨论(0)
提交回复
热议问题