<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Relay status check always fails for Google SMTP relay (External SMTP, no auth): EHLO [127.0.0.1] and a stale password]]></title><description><![CDATA[<p dir="auto"><strong>TL;DR:</strong> The daily "Email configuration error" is a false positive for relays like <code>smtp-relay.gmail.com</code>. The check greets the relay with <code>EHLO [127.0.0.1]</code> (rejected with a misleading <code>421 4.7.0 Try again later</code>), and then it would fail again on a leftover password that the dashboard can't clear.</p>
<p dir="auto"><strong>Setup</strong></p>
<ul>
<li>Cloudron 10.1.6, Ubuntu 24.04, server hostname <code>cloudron</code> (no dot)</li>
<li>Mail → Smart host: <em>External SMTP server (No authentication)</em> → <code>smtp-relay.gmail.com:587</code>, STARTTLS required. The server IP is authorized in Google Workspace's SMTP relay service (IP-based, no login). Six mail domains, all configured the same way.</li>
<li>Real delivery works. Haraka logs <code>delivered ... host=smtp-relay.gmail.com ... auth=N response="OK ..."</code>.</li>
</ul>
<p dir="auto"><strong>What I see</strong></p>
<p dir="auto">The daily check (<code>mailStatusCheck</code>) failed for all domains on at least 20 consecutive days:</p>
<pre><code>mailstatus: relay (example.com): Server terminates connection. response=421-4.7.0 Try again later, closing connection. (EHLO) ...
</code></pre>
<p dir="auto">The admin gets the notification and the e-mail again after every acknowledgement.</p>
<p dir="auto"><strong>Problem 1: the check greets the relay with <code>EHLO [127.0.0.1]</code></strong></p>
<p dir="auto"><code>checkSmtpRelay()</code> in <code>src/mailstatus.js</code> creates the nodemailer transport without a <code>name</code> option. According to the <a href="https://nodemailer.com/smtp" target="_blank" rel="noopener noreferrer nofollow ugc">Nodemailer docs</a>, the EHLO name defaults to the machine's hostname only if it is a fully-qualified domain name, otherwise <code>[127.0.0.1]</code> is sent. On a server whose hostname has no dot, Google's relay rejects that greeting:</p>
<pre><code>C: EHLO [127.0.0.1]
S: 421-4.7.0 Try again later, closing connection. (EHLO)
</code></pre>
<p dir="auto">while the same connection with a proper name is accepted:</p>
<pre><code>C: EHLO my.example.com
S: 250-smtp-relay.gmail.com at your service, [203.0.113.10]
</code></pre>
<p dir="auto">Google lists 421 4.7.0 as a rate-limiting response (<a href="https://knowledge.workspace.google.com/admin/gmail/advanced/route-outgoing-smtp-relay-messages-through-google" target="_blank" rel="noopener noreferrer nofollow ugc">SMTP relay docs</a>), so the message is very misleading. The same symptom was reported for another application in <a href="https://help.nextcloud.com/t/started-getting-smtp-errors-from-gmail-relay/107694" target="_blank" rel="noopener noreferrer nofollow ugc">this 2021 Nextcloud thread</a> (packet capture: <code>EHLO [127.0.0.1]</code> → <code>421 4.7.0</code>). Haraka announces the mail server FQDN, which is why real mail still works.</p>
<p dir="auto"><code>getStatus()</code> already has the FQDN (<code>const { fqdn } = await mailServer.getLocation()</code>) and passes it to <code>checkMx</code> and <code>checkSpf</code>, just not to <code>checkSmtpRelay</code>.</p>
<p dir="auto">Reproduction on the Cloudron host (no mail is sent):</p>
<pre><code class="language-bash">cd /home/yellowtent/box &amp;&amp; /usr/local/node-*/bin/node -e "
const nm = require('nodemailer');
(async () =&gt; {
  for (const name of ['[127.0.0.1]', 'my.example.com']) {   // use your mail server FQDN
    const tr = nm.createTransport({ host: 'smtp-relay.gmail.com', port: 587, secure: false, requireTLS: true, connectionTimeout: 5000, greetingTimeout: 5000, name });
    try { await tr.verify(); console.log('EHLO ' + name + ' -&gt; OK'); }
    catch (e) { console.log('EHLO ' + name + ' -&gt; FAIL: ' + e.message.split('\n')[0]); }
    tr.close();
  }
})();"
</code></pre>
<p dir="auto">Output:</p>
<pre><code>EHLO [127.0.0.1] -&gt; FAIL: Server terminates connection. response=421-4.7.0 Try again later, closing connection. (EHLO)
EHLO my.example.com -&gt; OK
</code></pre>
<p dir="auto"><strong>Problem 2: a stale password makes the check attempt SMTP AUTH with an empty username</strong></p>
<p dir="auto">For <code>external-smtp-noauth</code> the check still does:</p>
<pre><code class="language-js">if (relay.username || relay.password) {
    options.auth = { user: relay.username, pass: relay.password };
}
</code></pre>
<p dir="auto">My relay configs have an empty username but a leftover non-empty password (probably from an earlier authenticated setup). As soon as the EHLO problem is fixed, the check fails with <code>Missing credentials for "PLAIN"</code>, because Google advertises AUTH after STARTTLS. Haraka is not affected: in the mail container, <code>haraka.js</code> uses <code>auth_type = relay.username ? 'plain' : ''</code>.</p>
<p dir="auto">The stale password can't be removed from the dashboard:</p>
<ul>
<li>The <em>External SMTP server (No authentication)</em> form has no username/password fields. <code>SmartHostSettingsItem.vue</code> loads the stored password into the hidden field, re-submits it, and never sends an empty password.</li>
<li>When the provider is switched, the mail service's <code>setDomainRelay()</code> (<code>domains.js</code>) merges the previously stored <code>username</code>/<code>password</code> back into the new relay whenever the request body lacks those keys.</li>
</ul>
<p dir="auto">Only an API call with an explicit <code>"password": ""</code> clears it.</p>
<p dir="auto"><strong>Suggested changes</strong></p>
<ol>
<li>Pass the mail FQDN as the EHLO name in the relay check:</li>
</ol>
<pre><code class="language-diff">-async function checkSmtpRelay(relay) {
+async function checkSmtpRelay(relay, fqdn) {
 ...
     const options = {
         connectionTimeout: 5000,
         greetingTimeout: 5000,
+        name: fqdn, // otherwise nodemailer greets with [127.0.0.1] when os.hostname() is not an FQDN
         host: relay.host,
 ...
-        { what: 'relay', promise: checkSmtpRelay(mailDomain.relay) }
+        { what: 'relay', promise: checkSmtpRelay(mailDomain.relay, fqdn) }
</code></pre>
<ol start="2">
<li>In the check, set <code>auth</code> only when a username exists (the same rule Haraka uses), e.g. <code>if (relay.username) options.auth = {...}</code>, or skip <code>auth</code> for <code>external-smtp-noauth</code>.</li>
<li>Optionally, drop the stored username/password when saving a provider that doesn't use them, so stale credentials can't linger unnoticed.</li>
</ol>
<p dir="auto"><strong>Workaround (verified)</strong></p>
<ol>
<li>Give the server an FQDN hostname, e.g. <code>hostnamectl set-hostname my.example.com</code>. It is picked up immediately, since nodemailer calls <code>os.hostname()</code> for each new connection.</li>
<li>Clear the stale password through the API with a write-enabled token. Send all fields (keep your own values for host, port and flags), because only username/password are merged from the stored config:</li>
</ol>
<pre><code class="language-bash">curl -X POST -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
  -d '{"provider":"external-smtp-noauth","host":"smtp-relay.gmail.com","port":587,"username":"","password":"","acceptSelfSignedCerts":false,"requireTLS":true,"forceFromAddress":false}' \
  https://my.example.com/api/v1/mail/example.com/relay
</code></pre>
<p dir="auto">After both steps the relay check passes for all domains.</p>
<p dir="auto">Thanks!</p>
]]></description><link>https://forum.cloudron.io/topic/16324/relay-status-check-always-fails-for-google-smtp-relay-external-smtp-no-auth-ehlo-127.0.0.1-and-a-stale-password</link><generator>RSS for Node</generator><lastBuildDate>Tue, 24 Nov 2026 09:57:11 GMT</lastBuildDate><atom:link href="https://forum.cloudron.io/topic/16324.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 21 Nov 2026 00:03:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Relay status check always fails for Google SMTP relay (External SMTP, no auth): EHLO [127.0.0.1] and a stale password on Sat, 21 Nov 2026 20:28:45 GMT]]></title><description><![CDATA[<p dir="auto">Thanks, i have applied the fix!</p>
]]></description><link>https://forum.cloudron.io/post/133254</link><guid isPermaLink="true">https://forum.cloudron.io/post/133254</guid><dc:creator><![CDATA[girish]]></dc:creator><pubDate>Sat, 21 Nov 2026 20:28:45 GMT</pubDate></item><item><title><![CDATA[Reply to Relay status check always fails for Google SMTP relay (External SMTP, no auth): EHLO [127.0.0.1] and a stale password on Sat, 21 Nov 2026 00:12:12 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/%D1%8B%D0%B7%D1%83%D1%81%D0%B5%D0%BA%D1%83" aria-label="Profile: ызусеку">@<bdi>ызусеку</bdi></a> and welcome to the Cloudron community forum</p>
]]></description><link>https://forum.cloudron.io/post/133218</link><guid isPermaLink="true">https://forum.cloudron.io/post/133218</guid><dc:creator><![CDATA[james]]></dc:creator><pubDate>Sat, 21 Nov 2026 00:12:12 GMT</pubDate></item></channel></rss>