Email System not working after installation

117664

New member
Joined
Nov 8, 2022
Messages
4
I have set up DirectAdmin on an Ubuntu 20.04 system yesterday and have now noticed under ADMIN > Admin Tools > Email Tracking that all SENT emails are shown as "deferred", i.e. are not being delivered to the recipient.

For the panel, I have set up the service host as panel.example.com. I assume that mail.example.com will be used to send emails, and that host is also resolving to the server IP, and is also added under /etc/virtual as empty subdirectory (as described here). Also, diradmin_envelope is set to [email protected]. Example.com is also a domain registered for the panel under USER > Account Manager > Domain setup.

What could be the reason for the above, what troubleshooting steps can I take, and how can I possibly reset the mail system to fix the issue?

Thanks!
 
Hello.

You can check your logfiles like /var/log/exim/mainlog to see why the mail is not delivered. Mostly in the log, you can find the reason.

I don't know how often you have setup a server. But for e-mail to function properly, you need to have an rDNS/PTR record for your main domain the mailserver is running on.
For example, if your hostname is server.example.com and your server has ip 192.168.0.1, then you have to set the PTR/rDNS record for ip 192.168.0.1 to point to server.example.com so you have the correct record.

Ofcourse 192.168.0.1 is a private ip, but that's just used as an example.
Mostly you can set the rDNS/PTR at your datacenter panel or your vps provider. Otherwise ask them.

Next to that, check if everything is setup correctly.

Visit https://www.mail-tester.com/ and try to send a mai to the address given there, follow instructions. It will show you a result after a short while, which should at least be 9/10.
If it's lower, then it will be shown what to improve.

That's all for now, if you want more specific help, you need to share the domain name and/or parts of the logfile.
 
Thank you Richard. When looking into the exim/mailog file, I see the following:

2022-11-08 08:55:09 1osJRt-0000Mg-2x ** [email protected] F=<>: Unrouteable address
2022-11-08 08:55:09 1osJRt-0000Mg-2x Frozen (delivery error message)
2022-11-08 08:55:09 1osDd7-0002v2-12 ** [email protected] F=<[email protected]>: Unrouteable address
2022-11-08 08:55:09 cwd=/var/spool/exim 7 args: /usr/sbin/exim -t -oem -oi -f <> -E1osDd7-0002v2-12
2022-11-08 08:55:09 1osJRt-0000Mw-37 <= <> R=1osDd7-0002v2-12 U=mail P=local S=1984 T="Mail delivery failed: returning message to sender" from <> for [email protected]

The file /etc/virtual/domainips contains the following single entry (with xxx.xxx.xxx.xxx being my correct server IP):

*:xxx.xxx.xxx.xxx

I also ran
/usr/local/directadmin/directadmin set add_domain_to_domainips 1
and
systemctl restart directadmin
 
A quick follow up: I have added a PTR entry in the Add Zone menu, with the IP and the host name. Then, I ran # dig -x <IP> which results in the following:

; <<>> DiG 9.16.1-Ubuntu <<>> -x 166.235.200.223
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52686
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;223.200.235.166.in-addr.arpa. IN PTR

;; ANSWER SECTION:
223.200.235.166.in-addr.arpa. 5988 IN PTR static.223.200.235.166.clients.your-server.de.

;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Tue Nov 08 15:50:24 CET 2022
;; MSG SIZE rcvd: 116


I do not understand several topics: it isn't showing panel.example.com but static.223.etc instead. Your-server.de is Hetzner, which is where my server is located. I am able to also edit the Zone settings at Hetzner for the domain, but there is no PTR entry type available.
Then also I do not know why the order of IP digits is reverted, and what in-addr.arpa is, but that might be irrelevant here.

Do you have any further ideas what I could do to make this work? I have tried several other admin panels (Plesk Obs., CyberPanel) now, and for all of them the email system worked out of the box. I am sure there must only be some easy steps missing to make it work in DirectAdmin as well. Thanks!
 
ANSWER SECTION:
223.200.235.166.in-addr.arpa. 5988 IN PTR static.223.200.235.166.clients.your-server.de.
wait 5988 seconds till TTL expire and you will see new PTR
 
2022-11-08 08:55:09 1osJRt-0000Mg-2x ** [email protected] F=<>: Unrouteable address
2022-11-08 08:55:09 1osJRt-0000Mg-2x Frozen (delivery error message)
For these lines in the logs, those are messages to root, often these come from the firewall.

Edit your /etc/aliases file and at the bottom there might be something like:
# root marc

Remove the # and change it to:
root [email protected]
where [email protected] is ofcourse the email address you want to receive root mail at. After that restart Exim.
service exim restart

If that does not help, go to /root via SSH and create a file called .forward (mind the dot in front) there and put your email address in there.

edit the Zone settings at Hetzner for the domain, but there is no PTR entry type available.
Yes you can. You have the control panel at Hetzner. There you can see your ip, and change the PTR.
Click server, then click on your server and then you will see "Reverse DNS Entry", you can edit what's there. That is the PTR/rDNS record.

afbeelding.png
 
Back
Top