GMail “Allow Access for Less Secured Apps”


I created a Gmail account and I am SendEmailAsync to send email via that Gmail account through a VB6 program. I had to turn on “allow access for less secured apps” for that Gmail account but otherwise, I am able to get everything working. However, after some weeks of inactivity, Google would automatically turn disable access for less secured apps and block access.

Is there a way for me to send emails without having to turn on “allow less secured apps” setting ?


The term “less secured apps” means doing SMTP, POP3, or IMAP authentication with anything other than OAuth2.   (i.e. using password or digest authentication methods that have existed in these protocols for many years, and are still widely used.    Chilkat can do OAuth2 authentication with GMail — but as with any OAuth2 authentication, you’ll need to popup a browser to allow the GMail account owner to interactively authorize access.   However, once your app obtains the OAuth2 token, it can save it to persistent storage (file, database, etc.) so that the interactive browser interaction does not need to happen again.  The OAuth2 token can be refreshed as needed without user interaction.   (For example, if you use Mozilla Thunderbird and setup usage with a GMail account, you’ll notice the up-front request for authorization, but it never  has to be re-done.)

There are examples on for each of the programming language categories, under the “IMAP”, “SMTP”, and “POP3” categories, showing how to get a GMail OAuth2 token and how to use it.  For example:


and for refreshing an access token:


Tags :