Good morning,
I have some Nextcloud Docker installations that are configured to use the Gmail SMTP relay service that have been working fine up until recently. Suddenly they have started having problems sending email. They report the following error when sending a test email (which does not appear to be correct):
A problem occurred while sending the email. Please revise your settings. (Error: Expected response code 250 but got an empty response)
Running a packet capture to see whatâs really going on, this is what I see:
SMTP 125 S: 220 smtp-relay.gmail.com ESMTP x13sm1833773pjh.14 - gsmtp
SMTP 84 C: EHLO [127.0.0.1]
SMTP 148 S: 421 4.7.0 Try again later, closing connection. (EHLO) x13sm1833773pjh.14 - gsmtp
As you can see, there are explicit error codes 421 and 4.7.0 which is indeed not an empty response. Googleâs SMTP error reference says:
421, â4.7.0â, Try again later, closing connection. This usually indicates a Denial of Service (DoS) for the SMTP relay at the HELO stage.
What Iâve found is that if I use telnet to send an email from the server, it works fine, so I know the Gmail relay service configuration is correct. However I can also reproduce the above by sending HELO [127.0.0.1] and will receive the same error. So I donât think the relay has blocked the servers or anything like that as their error code reference suggests.
So evidently either they have stopped accepting EHLO [127.0.01], or Nextcloud was previously identifying itself differently and has changed. Iâm leaning toward the former but I donât actually know what changed.
What should happen is Nextcloud should identify itself with the domain name itâs configured to send from (example.com
), not [127.0.0.1]
. But, I donât know how to change this. I looked through the email configuration docs and compared against my config.php and everything appears to be set correctly.
'mail_smtpmode' => 'smtp',
'mail_sendmailmode' => 'smtp',
'mail_from_address' => 'nextcloud',
'mail_domain' => 'example.com',
'mail_smtphost' => 'smtp-relay.gmail.com',
'mail_smtpport' => '587',
'mail_smtpsecure' => 'tls',
The Nextcloud documentation mentions the ability to set advanced mail options using Swift Mailerâs streamOptions, however the site it links to does not actually have any documentation about a streamOptions parameter that I could find, and a web search of the topic didnât return anything useful.
Anyone know a solution to this?