Official Content

This article describes some specific considerations you need to take into account when sending or receiving emails using a Google Account (Gmail, Google for Business, or any edition).

Authentication and Authorization

As of May 30th, 2022, Google will no longer provide access to less secure apps (here is the announcement). That is to say, you cannot authenticate by just assigning in the Username and Password properties of the SMTPSession or POP3Session the email and password of the Google Account.

One solution is to use, instead of the Google Account password, an Application Specific Password.

Using application-specific Password

App Passwords can only be used with accounts that have 2-Step Verification turned on.

Sample code snippet setting properties to create a Pop3 session: 

&Pop3Session.Host = 'pop.gmail.com'
&Pop3Session.Port = 995
&Pop3Session.Timeout = 30
&Pop3Session.UserName = 'myemail@gmail.com'
&Pop3Session.Password = 'abcdabcdabcdabcd' // 16-digit App password given by Google
&Pop3Session.Secure=1

Steps to get an App Password:

  1. Turn on 2-Step Verification in the Google Account
  2. Create an app password
  3. Use that password in the application (assigning it to the corresponding Password property).

Note: The above is valid for all versions of GeneXus..

Using OAuth2

This method, which the recommended by Google, is available as of GeneXus 17 Upgrade 9. It requires additional programming using the OAuth Module and also specific configurations to use latest libraries for sending and receiving emails. More information about this at

See Also

SAC 50932 - OAUTH support for sending and receiving mails

 


Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant