My server can't send mail to gmail

When Hestia trying to send mail to @gmail.com account I get this error :

2023-08-11 15:11:45 1qURvd-000TEj-3q ** [email protected] R=send_via_smtp_relay T=smtp_relay_smtp: all hosts for 'gmail.com' have been failing for a long time (and retry time not reached)

I have set a AWS SES smtp credential as Global SMTP relay but the mails are still blocked…

What did I miss ?

for AWS SES
you need to replace a TRANSPORTS CONFIGURATION in exim conf
example default :

smtp_relay_smtp:
  driver = smtp
  hosts_require_auth = $host_address
  hosts_require_tls = $host_address

then replace :

smtp_relay_smtp:
  driver = smtp
  hosts_require_auth = $host_address
  hosts_require_tls = $host_address
  return_path = [email protected]

[email protected] is your AWS SES

1 Like

To be sure to understand, before doing this exim change, I had to :

After restart exim4, my mails to gmail are still blocked… what going wrong ?

can you show a log in exim ?

Hummm something going wrong, and not only with gmail.
If I’m trying to send a mail with the command echo "Test message" | mail -s "test message" [email protected] I get this error log :

2023-08-16 09:50:18 1qWBII-00E2xR-39 ** [email protected] R=send_via_smtp_relay T=smtp_relay_smtp: all hosts for 'mydomain.fr' have been failing for a long time (and retry time not reached)

The same error if I’m sending a mail on gmail.com mailboxes :


2023-08-16 09:52:19 1qWBKF-00E325-Jx ** [email protected] R=send_via_smtp_relay T=smtp_relay_smtp: all hosts for 'gmail.com' have been failing for a long time (and retry time not reached)

I have disables the global SMTP relay on HestiaCP, but the issue is still there…

First thing you should do, is to know what are the real errors that caused your mails are not being send:

exinext mydomain.fr
exinext gmail.com

Once solved, maybe you would like to use exim_tidydb command to remove those mails from retry exims’ db

2 Likes

Interesting !

The result of exinext mydomain.fr:

Transport: email-smtp.eu-west-1.amazonaws.com [34.255.52.203]:587 error -42: authentication required but authentication attempt(s) failed
  first failed: 11-Aug-2023 15:08:05
  last tried:   15-Aug-2023 14:30:30
  next try at:  15-Aug-2023 20:30:30
Transport: email-smtp.eu-west-1.amazonaws.com [34.255.52.203]:465 error -18: H=email-smtp.eu-west-1.amazonaws.com [34.255.52.203]: Remote host closed connection in response to initial connection
  first failed: 26-Jul-2023 12:47:12
  last tried:   17-Aug-2023 04:16:43
  next try at:  17-Aug-2023 10:16:43
  past final cutoff time
Transport: email-smtp.eu-west-1.amazonaws.com [52.213.48.220]:465 error -18: H=email-smtp.eu-west-1.amazonaws.com [52.213.48.220]: Remote host closed connection in response to initial connection
  first failed: 25-Jul-2023 17:17:20
  last tried:   17-Aug-2023 04:16:43
  next try at:  17-Aug-2023 10:16:43
  past final cutoff time
Transport: email-smtp.eu-west-1.amazonaws.com [52.209.231.219]:587 error -42: authentication required but authentication attempt(s) failed
  first failed: 11-Aug-2023 15:08:05
  last tried:   15-Aug-2023 14:30:30
  next try at:  15-Aug-2023 20:30:30
Transport: email-smtp.eu-west-1.amazonaws.com [52.209.231.219]:465 error -18: H=email-smtp.eu-west-1.amazonaws.com [52.209.231.219]: Remote host closed connection in response to initial connection
  first failed: 26-Jul-2023 12:47:12
  last tried:   17-Aug-2023 04:16:43
  next try at:  17-Aug-2023 10:16:43
  past final cutoff time
Transport: email-smtp.eu-west-1.amazonaws.com [52.213.48.220]:587 error -42: authentication required but authentication attempt(s) failed
  first failed: 11-Aug-2023 15:08:05
  last tried:   15-Aug-2023 14:30:30
  next try at:  15-Aug-2023 20:30:30

and exinext gmail.com :

Transport: email-smtp.eu-west-1.amazonaws.com [34.255.52.203]:587 error -42: authentication required but authentication attempt(s) failed
  first failed: 11-Aug-2023 15:08:05
  last tried:   15-Aug-2023 14:30:30
  next try at:  15-Aug-2023 20:30:30
Transport: email-smtp.eu-west-1.amazonaws.com [34.255.52.203]:465 error -18: H=email-smtp.eu-west-1.amazonaws.com [34.255.52.203]: Remote host closed connection in response to initial connection
  first failed: 26-Jul-2023 12:47:12
  last tried:   17-Aug-2023 04:16:43
  next try at:  17-Aug-2023 10:16:43
  past final cutoff time
Transport: email-smtp.eu-west-1.amazonaws.com [52.213.48.220]:465 error -18: H=email-smtp.eu-west-1.amazonaws.com [52.213.48.220]: Remote host closed connection in response to initial connection
  first failed: 25-Jul-2023 17:17:20
  last tried:   17-Aug-2023 04:16:43
  next try at:  17-Aug-2023 10:16:43
  past final cutoff time
Transport: email-smtp.eu-west-1.amazonaws.com [52.209.231.219]:587 error -42: authentication required but authentication attempt(s) failed
  first failed: 11-Aug-2023 15:08:05
  last tried:   15-Aug-2023 14:30:30
  next try at:  15-Aug-2023 20:30:30
Transport: email-smtp.eu-west-1.amazonaws.com [52.209.231.219]:465 error -18: H=email-smtp.eu-west-1.amazonaws.com [52.209.231.219]: Remote host closed connection in response to initial connection
  first failed: 26-Jul-2023 12:47:12
  last tried:   17-Aug-2023 04:16:43
  next try at:  17-Aug-2023 10:16:43
  past final cutoff time
Transport: email-smtp.eu-west-1.amazonaws.com [52.213.48.220]:587 error -42: authentication required but authentication attempt(s) failed
  first failed: 11-Aug-2023 15:08:05
  last tried:   15-Aug-2023 14:30:30
  next try at:  15-Aug-2023 20:30:30

However, I don’t understand how exim_tidydb works.
Where is my exim database ?

The dbs used by exim are here: /var/spool/exim4/db/

If you want to view the content of retry db you can use this command:

exim_dumpdb /var/spool/exim4/ retry

If you want to remove all retries older than 1 day:

exim_tidydb -t 1d /var/spool/exim4/ retry

If you want to remove ALL retries:

exim_tidydb -t 0d /var/spool/exim4/ retry

And yes, the dir is the right one /var/spool/exim4/, for these commands you don’t use the complete path to db /var/spool/exim4/db/

I hope this helps.

Edit: added space between parameter -t and arguments 0d and 1d

Cheers,
sahsanu

thanks !
The correct command is exim_tidydb -t 1d /var/spool/exim4/ retry with space after the -t parameter :slight_smile:
So I clean everything.
I setup again the global SMTP relay
But now, when I’m trying to send mail sur [email protected] I get this error :

2023-08-17 11:20:54 1qWZB1-002D3P-Lq H=email-smtp.eu-west-1.amazonaws.com [52.213.48.220]: Remote host closed connection in response to initial connection

2023-08-17 11:22:22 1qWZBS-002DBY-RR == [email protected] R=send_via_smtp_relay T=smtp_relay_smtp defer (-18) H=email-smtp.eu-west-1.amazonaws.com [52.213.48.220]: Remote host closed connection in response to initial connection

And obviously, my mail is not received…

Sorry, it was my fault, I wrote it in a hurry.

Regarding your Amazon issue, I can’t help, I’ve never used it as relay server.

try using the telnet or ping commands to connect to email-smtp.eu-west-1.amazonaws.com
from your server. If you still experience a timeout
it could be due to an issue with AWS or your server’s IP address may have been blocked by them.

I cannot ping and I get timeout with telnet from server, but also from home
So I think this is normal…

I would recommend contacting AWS support for assistance. They should be able to help you troubleshoot the issue. It should work, as I have used it before without having issue after adding return_path for Global SMTP relay with Exim4 using AWS SES.

And what should be precisely the return_path parameter ?
The verified address mail inside AWS SES ?
The email sender which send the mail from the server such [email protected] ?

Those are from the cron user.

1 Like

The verified address mail inside AWS SES ? yes
a email sender will from verified address mail inside AWS SES (when you first setup aws ses with ur custom domain)

ok so I have to create and validate a “checked once” mail [email protected]
I will try this :slight_smile: