Can't configure SMTP server, problems to send mails.

it's my very first time configuring a VPS. I needed it to install Moodle (education platform) , i configured everything but i'm having problems with the mails, a lot of the e-mails that should be sended when a user register to the website aren't been sended, but some of them are sended correctly so i don't know what could be wrong with the config that sometimes it works and sometimes it doesn't. Here it's the mail.log (just a few lines of it):

Apr 15 15:32:34 alexisvps sm-mta[27810]: 03CKrgxQ023485: to=<[email protected]>, delay=2+21:38:52, xdelay=00:00:00, mailer=esmtp, pri=37560000, relay=www.alexismoyano.com., dsn=4.0.0, stat=Deferred: Connection refused by www.alexismoyano.com.
Apr 15 15:32:34 alexisvps sm-mta[27810]: 03CKs3Y6024540: to=<[email protected]>, delay=2+21:38:31, xdelay=00:00:00, mailer=esmtp, pri=37560000, relay=www.alexismoyano.com., dsn=4.0.0, stat=Deferred: Connection refused by www.alexismoyano.com.
Apr 15 15:32:34 alexisvps sm-mta[27810]: 03CKruwu024205: to=<[email protected]>, delay=2+21:38:38, xdelay=00:00:00, mailer=esmtp, pri=37653045, relay=bhotmail.com. [75.126.101.244], dsn=4.0.0, stat=Deferred: Connection refused by bhotmail.com.
Apr 15 15:32:34 alexisvps sm-mta[27810]: 03CKrOvo022652: to=<[email protected]>, delay=2+21:39:10, xdelay=00:00:00, mailer=esmtp, pri=37653112, relay=gmail.com.ar. [37.152.88.55], dsn=4.0.0, stat=Deferred: Connection refused by gmail.com.ar.
Apr 15 15:32:34 alexisvps sm-mta[27810]: 03CKHXrQ020406: to=<[email protected]>, delay=2+22:15:01, xdelay=00:00:00, mailer=esmtp, pri=37920000, relay=www.alexismoyano.com., dsn=4.0.0, stat=Deferred: Connection refused by www.alexismoyano.com.
Apr 15 15:32:34 alexisvps sm-mta[27810]: 03BK07tD025497: to=<[email protected]>, delay=3+22:32:27, xdelay=00:00:00, mailer=esmtp, pri=44962181, relay=ucksmg01.inta.gob.ar., dsn=4.0.0, stat=Deferred: Connection timed out with ucksmg01.inta.gob.ar.
Apr 15 15:32:34 alexisvps sm-mta[27810]: 03C1vXae000918: to=<[email protected]>, delay=3+16:35:01, xdelay=00:00:00, mailer=esmtp, pri=47820000, relay=www.alexismoyano.com., dsn=4.0.0, stat=Deferred: Connection refused by www.alexismoyano.com.
Apr 15 15:32:34 alexisvps sm-mta[27810]: 03C1Ok6l000367: to=<[email protected]>, delay=3+17:07:48, xdelay=00:00:00, mailer=esmtp, pri=48090000, relay=www.alexismoyano.com., dsn=4.0.0, stat=Deferred: Connection refused by www.alexismoyano.com.

It repeats a looooooot lines like this one :

Apr 15 15:32:34 alexisvps sm-mta[27810]: 03CKrgxQ023485: to=<[email protected]>, delay=2+21:38:52, xdelay=00:00:00, mailer=esmtp, pri=37560000, relay=www.alexismoyano.com., dsn=4.0.0, stat=Deferred: Connection refused by www.alexismoyano.com.

Anyone has an idea of what could be happening?

Thanks!

3 Replies

Hello,

I've used my debugging tools at https://soliddevtools.com to do a little digging for you.

Apr 15 15:32:34 alexisvps sm-mta[27810]: 03CKrgxQ023485: to=<[email protected]>, delay=2+21:38:52, xdelay=00:00:00, mailer=esmtp, pri=37560000, relay=www.alexismoyano.com., dsn=4.0.0, stat=Deferred: Connection refused by www.alexismoyano.com.

The "to" address here is "[email protected]" which I'm guessing is the sender address the e-mails are being sent from?

If so, these look like bounce messages being returned to you.

The MX record for www.alexismoyano.com points back to alexismoyano.com (66.6.44.4).

This IP does not have any mail services running on it, so it cannot accept the message.

I think the root of your problem starts here:

Apr 15 15:32:34 alexisvps sm-mta[27810]: 03CKrOvo022652: to=<[email protected]>, delay=2+21:39:10, xdelay=00:00:00, mailer=esmtp, pri=37653112, relay=gmail.com.ar. [37.152.88.55], dsn=4.0.0, stat=Deferred: Connection refused by gmail.com.ar.

Apr 15 15:32:34 alexisvps sm-mta[27810]: 03BK07tD025497: to=<[email protected]>, delay=3+22:32:27, xdelay=00:00:00, mailer=esmtp, pri=44962181, relay=ucksmg01.inta.gob.ar., dsn=4.0.0, stat=Deferred: Connection timed out with ucksmg01.inta.gob.ar.

Both the domain names "gmail.com.ar" and "ucksmg01.inta.gob.ar" do not have any MX records set up - so they cannot accept mail. I'm guessing this is generating the bounce messages you're seeing.

My suggestion would be to tweak Moodle to use a real e-mail address for the sender - so any bounce messages are delivered successfully.

Sorry, i change de domain from the code to not expose the website in other forums where i asked. The real code is using "www.ceaervirtual.com" instead of "www.alexismoyano.com"

this is the code:

Apr 15 15:32:34 alexisvps sm-mta[27810]: 03CKrgxQ023485: to=<[email protected]>, delay=2+21:38:52, xdelay=00:00:00, mailer=esmtp, pri=37560000, relay=www.ceaervirtual.com., dsn=4.0.0, stat=Deferred: Connection refused by www.ceaervirtual.com.
Apr 15 15:32:34 alexisvps sm-mta[27810]: 03CKs3Y6024540: to=<[email protected]>, delay=2+21:38:31, xdelay=00:00:00, mailer=esmtp, pri=37560000, relay=www.ceaervirtual.com., dsn=4.0.0, stat=Deferred: Connection refused by www.ceaervirtual.com.
Apr 15 15:32:34 alexisvps sm-mta[27810]: 03CKruwu024205: to=<[email protected]>, delay=2+21:38:38, xdelay=00:00:00, mailer=esmtp, pri=37653045, relay=bhotmail.com. [75.126.101.244], dsn=4.0.0, stat=Deferred: Connection refused by bhotmail.com.
Apr 15 15:32:34 alexisvps sm-mta[27810]: 03CKrOvo022652: to=<[email protected]>, delay=2+21:39:10, xdelay=00:00:00, mailer=esmtp, pri=37653112, relay=gmail.com.ar. [37.152.88.55], dsn=4.0.0, stat=Deferred: Connection refused by gmail.com.ar.
Apr 15 15:32:34 alexisvps sm-mta[27810]: 03CKHXrQ020406: to=<[email protected]>, delay=2+22:15:01, xdelay=00:00:00, mailer=esmtp, pri=37920000, relay=www.ceaervirtual.com., dsn=4.0.0, stat=Deferred: Connection refused by www.ceaervirtual.com.
Apr 15 15:32:34 alexisvps sm-mta[27810]: 03BK07tD025497: to=<[email protected]>, delay=3+22:32:27, xdelay=00:00:00, mailer=esmtp, pri=44962181, relay=ucksmg01.inta.gob.ar., dsn=4.0.0, stat=Deferred: Connection timed out with ucksmg01.inta.gob.ar.
Apr 15 15:32:34 alexisvps sm-mta[27810]: 03C1vXae000918: to=<[email protected]>, delay=3+16:35:01, xdelay=00:00:00, mailer=esmtp, pri=47820000, relay=www.ceaervirtual.com., dsn=4.0.0, stat=Deferred: Connection refused by www.ceaervirtual.com.

I understand that the MX Records are okay on that domain, could you check that?

What you said to solve the problem is to create a noreply@ceaervirtual.com mail and that should solve the problem?

I'll try that. But I still can't understand why sometimes it's delivering the emails. Shouldn't be working always or never?

Thanks again!

I understand that the MX Records are okay on that domain, could you check that?

That domain looks good, it has what looks to be a valid MX record, however it’s only at the root domain, not the www.

Therefore yes, if you set your sender address as [email protected], and ensure it’s a valid mailbox (or a “black hole”) that should be fine.

But I still can't understand why sometimes it's delivering the emails. Shouldn't be working always or never?

The reason is some of the email addresses you’re sending mail to are not valid - gmail.com.ar has no valid MX records, so your server tries to bounce the email back to you. But your sender address domain (www. ceaervirtual.com) also has no valid MX setup, so it kinda gets stuck.

For emails your server sends to valid addresses, there is no need to send anything back to you, so you don’t have a problem.

Changing your sender address to something that’s valid won’t magically allow you to send to the @gmail.com.ar address - because it isn’t configured to receive email - but it will stop your server getting hung up with bounces it also cannot deliver.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct