{"id":3281,"date":"2026-03-16T13:58:57","date_gmt":"2026-03-16T13:58:57","guid":{"rendered":"https:\/\/www.mjtnet.com\/blog\/?p=3281"},"modified":"2026-03-16T13:58:57","modified_gmt":"2026-03-16T13:58:57","slug":"macro-scheduler-15-5-07-smtpsendmail-now-supports-oauth2","status":"publish","type":"post","link":"https:\/\/www.mjtnet.com\/blog\/2026\/03\/16\/macro-scheduler-15-5-07-smtpsendmail-now-supports-oauth2\/","title":{"rendered":"Macro Scheduler 15.5.07: SMTPSendMail Now Supports OAuth2"},"content":{"rendered":"\n<p>Macro Scheduler 15.5.07 introduces an important update to the&nbsp;<strong>SMTPSendMail<\/strong>&nbsp;command, adding support for&nbsp;<strong>OAuth2 authentication<\/strong>&nbsp;and improving timeout handling for more reliable email automation.<\/p>\n\n\n\n<p>These changes help ensure <a href=\"https:\/\/www.mjtnet.com\/macro-scheduler.htm\">Macro Scheduler<\/a> scripts continue working with modern email services as providers increasingly move away from basic username\/password authentication.<\/p>\n\n\n\n<h2>Why OAuth2 Support Matters<\/h2>\n\n\n\n<p>Many email providers \u2014 including&nbsp;<strong>Microsoft 365, Outlook.com and Gmail<\/strong>&nbsp;\u2014 are gradually disabling&nbsp;<strong>SMTP Basic Authentication<\/strong>. Instead they require&nbsp;<strong>OAuth2-based authentication<\/strong>.<\/p>\n\n\n\n<p>Without OAuth2 support, automated scripts that send email via SMTP may stop working when basic auth is disabled.<\/p>\n\n\n\n<p>With version&nbsp;<strong>15.5.07<\/strong>, Macro Scheduler\u2019s SMTPSendMail command now supports OAuth2 tokens, allowing scripts to authenticate securely with modern email providers.<\/p>\n\n\n\n<h2>Using OAuth2 with SMTPSendMail<\/h2>\n\n\n\n<p>To enable OAuth2 authentication simply set:<\/p>\n\n\n\n<ul>\n<li><code>SMTP_OAUTH2 = 1<\/code><\/li>\n\n\n\n<li><code>SMTP_OAUTH2_TOKEN = &lt;access token&gt;<\/code><\/li>\n<\/ul>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Let&gt;SMTP_OAUTH2=1<br>Let&gt;SMTP_OAUTH2_TOKEN=ya29.a0AfH6SMBx...<br>Let&gt;SMTP_USERID=yourname@gmail.com<br>Let&gt;SMTP_SSL=1<br>Let&gt;SMTP_PORT=465SMTPSendMail&gt;recipient@example.com,smtp.gmail.com,yourname@gmail.com,Your Name,Test subject,Test body,<\/pre>\n\n\n\n<p>Macro Scheduler expects a&nbsp;<strong>valid OAuth2 access token<\/strong>&nbsp;in&nbsp;<code>SMTP_OAUTH2_TOKEN<\/code>.<\/p>\n\n\n\n<p>Token retrieval itself is&nbsp;<strong>not handled automatically<\/strong>&nbsp;by SMTPSendMail. Your script (or another process) must obtain the access token from the provider first. This typically involves:<\/p>\n\n\n\n<ol>\n<li>Creating an application with your email provider (e.g. Azure AD or Google Cloud).<\/li>\n\n\n\n<li>Obtaining a&nbsp;<strong>client ID<\/strong>&nbsp;and&nbsp;<strong>client secret<\/strong>.<\/li>\n\n\n\n<li>Using these credentials to obtain a&nbsp;<strong>refresh token<\/strong>.<\/li>\n\n\n\n<li>Exchanging the refresh token for an&nbsp;<strong>access token<\/strong>.<\/li>\n\n\n\n<li>Passing the access token to SMTPSendMail via&nbsp;<code>SMTP_OAUTH2_TOKEN<\/code>.<\/li>\n<\/ol>\n\n\n\n<p>You can use Macro Scheduler\u2019s&nbsp;<strong>HTTPRequest<\/strong>&nbsp;command to perform these token exchanges if needed.<\/p>\n\n\n\n<h2>Improved SMTP Timeout Handling<\/h2>\n\n\n\n<p>Version 15.5.07 also improves the behaviour of the&nbsp;<code>SMTP_TIMEOUT<\/code>&nbsp;variable.<\/p>\n\n\n\n<p>Previously this timeout applied&nbsp;<strong>only to the initial connection<\/strong>&nbsp;to the SMTP server. In some environments this could still leave scripts waiting indefinitely if a later SMTP operation stalled.<\/p>\n\n\n\n<p>Now the timeout applies to&nbsp;<strong>all SMTP operations<\/strong>, including:<\/p>\n\n\n\n<ul>\n<li>Authentication<\/li>\n\n\n\n<li>Message transfer<\/li>\n\n\n\n<li>Server responses<\/li>\n<\/ul>\n\n\n\n<p>This results in more predictable behaviour when network issues or server delays occur.<\/p>\n\n\n\n<h2>Existing Scripts Continue to Work<\/h2>\n\n\n\n<p>If your SMTP server still supports&nbsp;<strong>username\/password authentication<\/strong>, existing scripts will continue to work exactly as before using:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Let&gt;SMTP_AUTH=1<br>Let&gt;SMTP_USERID=myuser<br>Let&gt;SMTP_PASSWORD=mypassword<\/pre>\n\n\n\n<p>OAuth2 is simply an&nbsp;<strong>additional authentication option<\/strong>&nbsp;for providers that require it.<\/p>\n\n\n\n<h2>Full Documentation<\/h2>\n\n\n\n<p>You can find the full SMTPSendMail documentation here:<\/p>\n\n\n\n<p><a href=\"https:\/\/www.mjtnet.com\/manuals\/b\/v15\/topics\/smtpsendmail.htm\">https:\/\/www.mjtnet.com\/manuals\/b\/v15\/topics\/smtpsendmail.htm<\/a><\/p>\n\n\n\n<h2>Download Macro Scheduler 15.5.07<\/h2>\n\n\n\n<p>If you rely on SMTP automation in your scripts, we recommend upgrading to\u00a0<strong>Macro Scheduler 15.5.07<\/strong>\u00a0to ensure compatibility with modern email systems.<br><br><a href=\"https:\/\/www.mjtnet.com\/macro-scheduler.htm\">Trial Downloads<\/a> | <a href=\"https:\/\/www.mjtnet.com\/ua.htm\">Registered Updates<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Macro Scheduler 15.5.07 introduces an important update to the&nbsp;SMTPSendMail&nbsp;command, adding support for&nbsp;OAuth2 authentication&nbsp;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 \u2014 including&nbsp;Microsoft 365, Outlook.com and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,11],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/posts\/3281"}],"collection":[{"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/comments?post=3281"}],"version-history":[{"count":1,"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/posts\/3281\/revisions"}],"predecessor-version":[{"id":3282,"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/posts\/3281\/revisions\/3282"}],"wp:attachment":[{"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/media?parent=3281"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/categories?post=3281"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/tags?post=3281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}