GMail OAuth2 Scope for SMTP vs REST API

There’s confusion about the OAuth2 scope required to send email via GMAIL.

There are two ways to programmatically send email using your GMail account:

  1. Connecting to smtp.gmail.com using the SMTP protocol (i.e. using Chilkat.MailMan)
  2. Calling the GMail REST API over HTTPS using Chilkat.Http or Chilkat.Rest.

 

The scope for IMAP, POP, and SMTP access is https://mail.google.com/

See https://developers.google.com/gmail/imap/xoauth2-protocol

If your app is not formally verified by Google (which, at the time of this writing, involves a  yearly fee) then you’ll see an “unverified app” warning in the browser during the OAuth2 authorization flow.

With the HTTP REST API, more granular restricted scopes, such as https://www.googleapis.com/auth/gmail.send can be used.

Chilkat provides examples in all supported programming langauges for both SMTP and HTTP/REST on example-code.com.

For example:

Tags :