4D Blog

Home Product Connect your mail transporters with an OAuth 2.0 token

Connect your mail transporters with an OAuth 2.0 token

January 21, 2021

Product

Lately, email servers on the web have started to move to OAuth 2.0 authentication to increase security. Starting with 4D v18 R6, 4D provides a way to set the OAuth 2.0 authentication mode of a connection. Keep reading for the details!

HDI OAuth2 connection

IMAP, SMTP, and POP3 transporters now natively support OAuth 2.0 authentication. The OAuth 2.0 protocol is used to obtain an access token that allows you access to your emails. To use it, you just need to create your transporter as usual and replace the password attribute with the new accessTokenOAuth2 attribute, then add your token there.

For example, to create an IMAP transporter with OAuth 2.0:

$parameters:=New object
$parameters.authenticationMode:=IMAP authentication OAUTH2
// Token received from the web mail server
$parameters.accessTokenOAuth2:=$token
// e-mail address of the user for whom the token was created
$parameters.user:=$user
$parameters.host:="Outlook.office365.com"
$parameters.port:=995
$imapTransporter:=IMAP New transporter($parameters)

Download the HDI above to see OAuth 2.0 authentication in action by connecting your Gmail account!

And check out the doc center for more details!

 

Discuss

Tags Mail, OAuth 2.0, v18 R6, v19

Latest related posts

  • January 9, 2026

    Session handling in 4D Qodly Pro

  • January 7, 2026

    Enhance your Desktop Interface with Web widgets using 4D Qodly Pro

  • January 7, 2026

    Embed Qodly pages in a 4D web area without extra cost

Fabrice Mainguené
Fabrice Mainguené
• Product Owner •Fabrice Mainguené joined 4D Program team in November, 2016. As a Product Owner, he is in charge of writing the user stories then translating it to functional specifications. His role is also to make sure that the feature implementation delivered is meeting the customer need.After obtaining a Bachelor degree in Computer Science at CNAM, Fabrice joined a small software publishing company as a Windev developer. Then he worked for different companies in industry and trade areas as a Windev and web developer as well as technical advisor on new features.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • AI
  • 4D View Pro
  • 4D Write Pro
  • 4D for Mobile
  • Email
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • Qodly Studio
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D-Analyzer 4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 Administration AI Artificial Intelligence Build application CI/CD Class Client/Server Code editor Collections Formula Listbox Logs Mail Microsoft 365 Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience vscode Web Word processor

Tags

4D-Analyzer 4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 Administration AI Artificial Intelligence Build application CI/CD Class Client/Server Code editor Collections Formula Listbox Logs Mail Microsoft 365 Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience vscode Web Word processor
Subscribe to 4D Newsletter

© 2026 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy