3

I would like to send email via Gmail using a service account API. I am able to do this with a Client ID and Client Secret, but a service account doesn't have a client secret. Here's what I do have:

{
  "type": "service_account",
  "project_id": "my-project-id",
  "private_key_id": "107...",
  "private_key": "-----BEGIN PRIVATE KEY-----\nMII...=\n-----END PRIVATE KEY-----\n",
  "client_email": "something@something.iam.gserviceaccount.com",
  "client_id": "103...",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://accounts.google.com/o/oauth2/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/something%40something.iam.gserviceaccount.com"
}

How can I use this information to connect and send an email? All the documentation seems to reference non-service accounts.

AL.
  • 36,815
  • 10
  • 142
  • 281
Dave
  • 2,735
  • 8
  • 40
  • 44
  • Have you seen this [answer](http://stackoverflow.com/a/33246332/6124253)? It simply says it's not possible to send email using Gmail via the service account. He did mention some workarounds though. – AL. Apr 07 '16 at 06:19
  • Possible duplicate of [GMAIl API - Can I send email using the Service Account?](http://stackoverflow.com/questions/33233694/gmail-api-can-i-send-email-using-the-service-account) – AL. Apr 07 '16 at 07:37

0 Answers0