Email delivery failed

Hello, everything worked fine, till one day, I just stopped receiving any emails, for like week, then suddenly it started to work again, BUT now I can’t send emails (but receive them). If I try to send email I get this message

"This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

all hosts for ‘gmail’ have been failing for a long time (and retry time not reached)

Reporting-MTA: dns; localhost

Action: failed
Final-Recipient: rfc822;
Status: 5.0.0"

Little bit about setup, I am quite new to this server things, so I did everything like in this tutorial

What I used following this, Oracle Free Tier + Namecheap + Putty + Hestia + Brevo as SMTP relay. Due to limits in my knowledge, I tried to follow this video one more time (because it worked when I setup website first time) made sure that my DNS records setup is correct, tried to remove SPF (because read that Brevo does not require that), then add it back, but no luck.

Sahsanu recommended to do hostname -f, only one place where I remember there was command prompt, was actually Putty, so I tried that command in there, result is hcpDOTmydomainDOTcom (mydomain is just for privacy, there is actually my domain). To make it easier I will put some screenshots

Hi @redas1,

And you received a mail saying the host is 'gmail' instead of 'gmail.com'?

The first you should do is check your exim log /var/log/exim4/mainlog

You can also search it by the mail address:

exigrep '[email protected]' /var/log/exim4/mainlog*

or

exigrep '[email protected]' /var/log/exim4/mainlog*

Did you configure smtp relay globally or per mail domain?

Yes, I just had to replace it, because forum does not let me to use many links in my post. Sorry for stupid question but
“The first you should do is check your exim log `/var/log/exim4/mainlog”

How to do that?

“Did you configure smtp relay globally or per mail domain?”

I don’t really know, how I can check that?

Thanks for your help

Login to your server using ssh and as root use cat, vi, nano, tail, etc. commands to view the contents of the file.

Try to send an email and just after that run this command:

tail -n20 /var/log/exim4/mainlog

Or better use exigrep like I wrote in my last post:

To check if you enabled it globally from Web UI: Click on Server settings -> Configure -> Mail Server and check if you enabled Global SMTP Relay and filled the right data.

To check if you enabled it per mail domain, Select the user -> Click on Mail -> Click on your mail domain -> Button Edit mail domain and here you will see if you enabled SMTP Relay for that domain.

Okay, I’ve checked, flag for “Global SMTP Relay” unchecked.
dfde

SMTP Relay activated, but Password was missing, I add it, but email still not sending, I will show what command exigrep ‘[email protected]’ /var/log/exim4/mainlog*

Printed, and will do it one more time, to see if anything changes

Idk why, but when I put password and click “Save” it say that everything is saved, but password not there…

But do you have smtp relay activated per domain? Because if you do, then that smtp_relay will take precedence over global smtp relay.

cat /home/*/conf/mail/redasgames.com/smtp_relay.conf

With above command you will see if you have configured smtp relay to your specific mail domain and the credentials it is using.

That’s fine, Hestia won’t show the password again when it has been saved.

If you want to check whether it has been saved:

cat /etc/exim4/smtp_relay.conf
1 Like

cat /home/*/conf/mail/redasgames.com/smtp_relay.conf

I did this, and console printed

host:smtp-relay.brevo.com

port:587

user: (user that defined in there)

pass: (password that I put there)

In other words, in console I see information from here

cat /etc/exim4/smtp_relay.conf

Console printed: No such file and directory

Strange because I can see password if I do cat /home/*/conf/mail/redasgames.com/smtp_relay.conf

If you enabled Global SMTP Relay the file should be there:

ls -l /etc/exim4/

Anyway, you added the smtp relay to your mail domain and it should work fine. Did you add the right user and password?

Should I switch on “Global SMTP”

Well yes I have correct login (I used to have wrong one, with which for some reason everything worked, till one day), and I have correct SMTP key, one I generated (like in tutorial I mentioned in the first post), with which everything worked (but not master password).

If all your domains will use the same smtp relay, yes, and remove the smtp relay conf per domain.

Sorry but it isn’t clear to me whether it works now or not. If you are using the right credentials and you have validated your domain in Brevo but you still see the authentication failed issue, better contact direcctly to Brevo’s support.

Wait a minute… you said you are using Oracle’s Cloud… one moment, i’ll be bak because as far as i know you should modify the exim conf.

Ok, edit file /etc/exim4/exim4.conf.template and in this section:

smtp_relay_login:
driver = plaintext
public_name = LOGIN
hide client_send = : SMTP_RELAY_USER : SMTP_RELAY_PASS

Replace:

hide client_send = : SMTP_RELAY_USER : SMTP_RELAY_PASS

by:

hide client_send = ^SMTP_RELAY_USER^SMTP_RELAY_PASS

So it will look like this:

smtp_relay_login:
driver = plaintext
public_name = PLAIN
hide client_send = ^SMTP_RELAY_USER^SMTP_RELAY_PASS

Save the file, restart Exim and try again.

systemctl restart exim4

After I did this change (or probably when I changed user credentials again), email is getting sent and receive, but there is a bigger problem now (because no one will see my emails now), all my emails goes into spam folder (no matter to who I send email or what actually in there)…When I just setup this website via that tutorial, my emails never get into spam…PS - I never used this email, I used it once, to test if it’s working, and it worked fine.

Maybe a mix of both :wink:

Well maybe the external mail servers doesn’t like Brevo mail servers.

Use this tool to send a test mail from your server and see what mail-tester thinks about your mail (there is a limit of 3 tests per day).

Also, you can try another free (with limits) smtp relay server like smt2go.com maybe you will be luckiest.