Macro Scheduler 15.5.07: SMTPSendMail Now Supports OAuth2

Published on March 16, 2026 by Marcus Tettmar in Announcements, Web/Tech

Macro Scheduler 15.5.07 introduces an important update to the SMTPSendMail command, adding support for OAuth2 authentication and improving timeout handling for more reliable email automation.

These changes help ensure Macro Scheduler scripts continue working with modern email services as providers increasingly move away from basic username/password authentication.

Why OAuth2 Support Matters

Many email providers — including Microsoft 365, Outlook.com and Gmail — are gradually disabling SMTP Basic Authentication. Instead they require OAuth2-based authentication.

Without OAuth2 support, automated scripts that send email via SMTP may stop working when basic auth is disabled.

With version 15.5.07, Macro Scheduler’s SMTPSendMail command now supports OAuth2 tokens, allowing scripts to authenticate securely with modern email providers.

Using OAuth2 with SMTPSendMail

To enable OAuth2 authentication simply set:

  • SMTP_OAUTH2 = 1
  • SMTP_OAUTH2_TOKEN = <access token>

Example:

Let>SMTP_OAUTH2=1
Let>SMTP_OAUTH2_TOKEN=ya29.a0AfH6SMBx...
Let>[email protected]
Let>SMTP_SSL=1
Let>SMTP_PORT=465SMTPSendMail>[email protected],smtp.gmail.com,[email protected],Your Name,Test subject,Test body,

Macro Scheduler expects a valid OAuth2 access token in SMTP_OAUTH2_TOKEN.

Token retrieval itself is not handled automatically by SMTPSendMail. Your script (or another process) must obtain the access token from the provider first. This typically involves:

  1. Creating an application with your email provider (e.g. Azure AD or Google Cloud).
  2. Obtaining a client ID and client secret.
  3. Using these credentials to obtain a refresh token.
  4. Exchanging the refresh token for an access token.
  5. Passing the access token to SMTPSendMail via SMTP_OAUTH2_TOKEN.

You can use Macro Scheduler’s HTTPRequest command to perform these token exchanges if needed.

Improved SMTP Timeout Handling

Version 15.5.07 also improves the behaviour of the SMTP_TIMEOUT variable.

Previously this timeout applied only to the initial connection to the SMTP server. In some environments this could still leave scripts waiting indefinitely if a later SMTP operation stalled.

Now the timeout applies to all SMTP operations, including:

  • Authentication
  • Message transfer
  • Server responses

This results in more predictable behaviour when network issues or server delays occur.

Existing Scripts Continue to Work

If your SMTP server still supports username/password authentication, existing scripts will continue to work exactly as before using:

Let>SMTP_AUTH=1
Let>SMTP_USERID=myuser
Let>SMTP_PASSWORD=mypassword

OAuth2 is simply an additional authentication option for providers that require it.

Full Documentation

You can find the full SMTPSendMail documentation here:

https://www.mjtnet.com/manuals/b/v15/topics/smtpsendmail.htm

Download Macro Scheduler 15.5.07

If you rely on SMTP automation in your scripts, we recommend upgrading to Macro Scheduler 15.5.07 to ensure compatibility with modern email systems.

Trial Downloads | Registered Updates