Not able to send email

Bastiaandegeode

Verified User
Joined
Jun 3, 2024
Messages
11
Hello fellow DirectAdmin administrators,

For our clients i installed an new DirectAdmin server on Rocky 9 to migrate from an older DA server.
It is an vanilla installatian with as few changes as possible.

Now i have configurerd an test client with MX and SPF Records.
When i send mail to this client, i got the mail, but sending out from DA to Gmail, Outlook, it got stuck in the Mail Que.

In the que i see this error:
2024-06-03 10:09:11 <adress>@hotmail.nl R=lookuphost T=remote_smtp defer (-54): retry time not reached for any host for 'hotmail.nl'
2024-06-03 16:04:06 <adress>@hotmail.nl R=lookuphost T=remote_smtp defer (111): Connection refused
2024-06-03 16:42:16 H=hotmail-nl.b-v1.mx.microsoft [104.47.13.33] Connection refused
2024-06-03 16:42:17 H=hotmail-nl.b-v1.mx.microsoft [104.47.12.33] Connection refused
2024-06-03 16:42:18 H=hotmail-nl.b-v1.mx.microsoft [104.47.14.33] Connection refused

When i disable CSF the will send to Hotmail, Outlook or Gmail without any problems.
I dit not changes anything in CSF. Is is Default DA configuration and it "looks" the same as out old DA server.

TCP_IN: 35000:35999,20,21,22,25,53,853,80,110,143,443,465,587,993,995,2222
TCP_Out: 143,20,21,22,25,53,853,80,110,113,443,587,993,995,2222
TCP6_IN: 35000:35999,20,21,22,25,53,853,80,110,143,443,465,587,993,995,2222
TCP6_Out: 143,20,21,22,25,53,853,80,110,113,443,587,993,995,2222

SMTP_Block: ON
SMTP_Allowlocal: ON
SMTP_Ports: 25,465,587
SMTP_ALLOWGROUP: Mail,Mailman

Telnet to 25 out is also blocked.

In log i see this when i send an e-mail, tail /var/log/messages -n 100;
Jun 5 10:09:10 da04 kernel: Firewall: *TCP_OUT Blocked* IN= OUT=eth0 SRC=84.247.12.199 DST=127.0.0.1 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=30603 DF PROTO=TCP SPT=55984 DPT=44963 WINDOW=64240 RES=0x00 SYN URGP=0 UID=8 GID=12

what could be wrong in the installation that CSF block the mail Out traffic?
 
Hello zEitEr,

Thanks for your reply.

I see in other fora posts that SMTP_Bock On is strongly recomended, and this is also enabled in our other DA servers without any problem.
VPS TransIP "Mail traffic allow" is enabled, port 25 is only blocked when i enable CSF.
If i disable CSF on the server i can connect on port 25 to other MX servers.
 
If i disable CSF on the server i can connect on port 25 to other MX servers.

You know the reason. So you might either configure the things to work or disable SMPT_BLOCK.

If you leave the SMTP_BLOCK enabled, then you will need to configure a trusted list of users, groups.

Code:
SMTP_ALLOWUSER = ""
SMTP_ALLOWGROUP = ""

Beside that you might need to make sure you've got:

Code:
tcp|out|u=0 # Added by DirectAdmin
udp|out|u=0 # Added by DirectAdmin

in /etc/csf/csf.allow
 
SMTP_Block: Off
and SMTP_AllowUser: "Username client"
Dit not work. Same Error.
2024-06-05 10:39:06 Received from support@<domain>.nl H=localhost (da04.<domain>.nl) [::1] P=esmtpa A=login:support@<domain>.nl S=535 id=6da939248f591377676967219759dd03@<domain>.nl T="test"
2024-06-05 10:39:06 bastiaan@<domain>.nl R=lookuphost T=remote_smtp defer (-54): retry time not reached for any host for '<domain>.nl'

Also i got this:
tcp|out|u=0 # Added by DirectAdmin - Thu May 2 16:01:05 2024
udp|out|u=0 # Added by DirectAdmin - Thu May 2 16:01:05 2024
 
Retry from the mail Que in Directadmin i got the same 111 connection error.
Telnet from root in SSH didn't work when CSF is enabled, But now i can connect to and other MX server. ? How i do not know but oke.

Sending mail did still not work.

I have rebuild EXIM (again)
da build set exim yes
da build set eximconf yes
da build exim
da build exim_config

Restarted the server.
Retry sending mail -> It works!
SMTP_Block: ON (recommended in other fora) -> Restart CSF -> Sending mail Works!
Still added the user in SMTP_ALLOWUSER: <Username>

Again server rebooted to be sure.

And mail still works! :D
Telnet is blocked again as root (because of SMTP_Block: ON i think)

----------------------------

hmm not to fast. :/

mail is blocked again even with SMTP_Block Off.
Reboot, nope, Rebuild Exim, dit nothing, reboot, nothing.

Still error 111 connection refused.
 
All is already said, I don't see what can be added here. No time to play a guess game. Sorry.

I could check it on your server, you will be charged in this case.

If you want to debug further, then you might try the same:

Bash:
[secret-user@*****.poralix.net ~]$ host hotmail.nl
hotmail.nl has address 204.79.197.209
hotmail.nl mail is handled by 0 hotmail-nl.b-v1.mx.microsoft.
[secret-user@*****.poralix.net ~]$

[secret-user@*****.poralix.net ~]$ host hotmail-nl.b-v1.mx.microsoft
hotmail-nl.b-v1.mx.microsoft has address 104.47.22.161
hotmail-nl.b-v1.mx.microsoft has address 104.47.18.225
hotmail-nl.b-v1.mx.microsoft has address 104.47.18.161
[secret-user@*****.poralix.net ~]$

[secret-user@*****.poralix.net ~]$ telnet 104.47.18.225 25
Trying 104.47.18.225...
Connected to hotmail-nl.b-v1.mx.microsoft.
Escape character is '^]'.
220 VI1EUR06FT047.mail.protection.outlook.com Microsoft ESMTP MAIL Service ready at Wed, 5 Jun 2024 11:57:36 +0000
^]
telnet> Connection closed.
[secret-user@*****.poralix.net ~]$


[secret-user@*****.poralix.net ~]$ telnet 104.47.22.161 25
Trying 104.47.22.161...
Connected to 104.47.22.161.
Escape character is '^]'.
220 DB8EUR06FT058.mail.protection.outlook.com Microsoft ESMTP MAIL Service ready at Wed, 5 Jun 2024 11:57:49 +0000
^]
telnet> Connection closed.
[secret-user@*****.poralix.net ~]$


[secret-user@*****.poralix.net ~]$ telnet 104.47.18.161 25
Trying 104.47.18.161...
Connected to 104.47.18.161.
Escape character is '^]'.
220 AM7EUR06FT051.mail.protection.outlook.com Microsoft ESMTP MAIL Service ready at Wed, 5 Jun 2024 11:57:56 +0000
^]
telnet> Connection closed.
[secret-user@*****.poralix.net ~]$


I did it on my server hosted at TransIP.

You might try other server as well, and see whether you have the issue with hotmail.nl only, or and other servers as well. Clean csf.deny and see whether it changes anything, probably banned some IPs. Check iptables rules, etc.

If you can not connect only to hotmail.nl, then your IP might be blocked by them.
 
Oke, found something,
IF i do CSF -F , and force the mail to be send again, it works.

And after a few minuts it is blocked again.
 
Last edited:
And after a few minuts it is blocked again.

If you modified firewall to allow outgoing connections, and then connections got blocked again - then probably you have either a service or script which changes firewall settings. No chances to guess what might it be.
 
It is a fresh installation, so i do not know what causes this.

Well i'm re-using an legacy (life time) licence from the old DA server on the new server, and need to restart the DA were i want to connect to oterwise the portal is bocked.
Messages: Service restart from CLI can be done with command:
systemctl restart directadmin.service

Could there be a proces in the background that disabled mail because of this on the new server?
 
That was my guess. I don't know what and how blocks outgoing connections on your server. I read what you write, and as much as you share.

DirectAdmin does not block outgoing traffic to SMTP ports. CSF/LFD does not re-add rules, if you modify csf.conf.

Could there be a proces in the background that disabled mail because of this on the new server?

malware? virus? Yes, it could be. But no DirectAdmin, CSF/LFD.
 
Okee, found the solution!! :D @zEitEr

I did not add on User level in MX Records the "primairy domain" from this server.
Now i added that, everything works now!!.
Little did i know that this was necessary..... The errors sended me to completely different locations to look for..

1718961454469.png
 
Back
Top