By hedgert
I’ve been following a tutorial to set up a mail server (on the same server at nextcloud). The tutorial is here: https://123qwe.com/tutorial-debian-10/
All seemed to be working as expected until it came to testing email. I can send email but I’m not receiving anything. When I send email from another device, my sending clients don’t report any issues in sending the mail, but nothing happens with postfix. /var/log/mail.log shows nothing at all when I send mail to the domain the server is set up on. (Nothing shows in syslog either).
I found this related question on this forum:
https://www.digitalocean.com/community/questions/postfix-can-send-but-not-receive-external-email#
And it asks if postfix is listening on port 25 - having run the lsof command, postfix doesn’t seem to be listening on any port. So I guess that’s at least part of the issue. My lsof output (grep for 25, dovecot, rspamd and postfix) is:
ubuntu@myserver:~$ sudo lsof -iTCP -sTCP:LISTEN -P |egrep "25|dovecot|rspamd|postfix|postgre"
postgres 727 postgres 3u IPv4 20741 0t0 TCP localhost:5432 (LISTEN)
rspamd 1173 root 9u IPv4 22918 0t0 TCP localhost:11332 (LISTEN)
rspamd 1173 root 11u IPv4 22923 0t0 TCP localhost:11334 (LISTEN)
rspamd 1173 root 14u IPv4 22928 0t0 TCP localhost:11333 (LISTEN)
rspamd 156792 _rspamd 9u IPv4 22918 0t0 TCP localhost:11332 (LISTEN)
rspamd 156792 _rspamd 11u IPv4 22923 0t0 TCP localhost:11334 (LISTEN)
rspamd 156792 _rspamd 14u IPv4 22928 0t0 TCP localhost:11333 (LISTEN)
rspamd 156793 _rspamd 9u IPv4 22918 0t0 TCP localhost:11332 (LISTEN)
rspamd 156793 _rspamd 11u IPv4 22923 0t0 TCP localhost:11334 (LISTEN)
rspamd 156793 _rspamd 14u IPv4 22928 0t0 TCP localhost:11333 (LISTEN)
rspamd 156794 _rspamd 9u IPv4 22918 0t0 TCP localhost:11332 (LISTEN)
rspamd 156794 _rspamd 11u IPv4 22923 0t0 TCP localhost:11334 (LISTEN)
rspamd 156794 _rspamd 14u IPv4 22928 0t0 TCP localhost:11333 (LISTEN)
dovecot 158604 root 15u IPv4 1147425 0t0 TCP *:4190 (LISTEN)
dovecot 158604 root 16u IPv6 1147426 0t0 TCP *:4190 (LISTEN)
dovecot 158604 root 38u IPv4 1147473 0t0 TCP *:143 (LISTEN)
dovecot 158604 root 39u IPv6 1147474 0t0 TCP *:143 (LISTEN)
dovecot 158604 root 40u IPv4 1147475 0t0 TCP *:993 (LISTEN)
dovecot 158604 root 41u IPv6 1147476 0t0 TCP *:993 (LISTEN)
master 161752 root 13u IPv4 1162695 0t0 TCP *:25 (LISTEN)
master 161752 root 14u IPv6 1162696 0t0 TCP *:25 (LISTEN)
The relevant line from postfix/master.cf is:
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (no) (never) (100)
# ==========================================================================
smtp inet n - y - - smtpd -v
Which if I’m understanding other posts correctly means postfix should default to port 25?
Any suggestions on where to start to fix this?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi @hedgert,
Firstly, I’ll recommend using port 465 for sending out messages rather than 25. Port 25 is considered an unsecured port and more often than not providers block emails from it.
Another possibility is the IP of the Droplet is considered as a threat due to some reason.
I do believe messages are being sent but just are always deferred by the host. I’ll recommend using an e-mail checker to see what score your E-mails rank up to. The link is here - https://www.mail-tester.com/. The way it works is you send a message to the given e-mail account and check the score of your message. It will provide you with a scale from 1 to 10 and notify you about any issues you might need to fix.
Try it out and see if after making a 10/10 score on the tester the messages will still be marked as spam.
One other thing, you know content does matter and it’s possibly Gmail are marking your messages based on it.
Regards, KDSys
Thank you for your reply - alas (in your suggestion of using a different port) you are further on than I am with my setup! If I could get postfix working then I’ll gladly look at better ports.
This is where I’ve got to: postfix is not listening on port 25 other than on localhost. I can telnet to localhost on the machine using port 25. But if I telnet to the IP address using port 25, then I get connection refused. (When the telnet connects on localhost, the syslog lights up with action, when I try to connect from offhost, then nothing happens on syslog.
The ubuntu ufw firewall is not active. I have inet_interfaces=all in /etc/postfix/main.cf
But I cannot connect on port 25 (which any mail programme trying to send email to my email server will surely do - so not sure what the port change will achieve anyway once I can get it working).
Any suggestions for what else I can try?
Heya,
On top of what’s already been mentioned, I would like to mention that SMTP is disabled by default from June 22, 2022, for all new accounts.
https://www.digitalocean.com/blog/smtp-restricted-by-default
You can use third-party services like SendGrid which is also available as a one-click droplet via our marketplace:
https://marketplace.digitalocean.com/apps/sendgrid
You can also check our article on Why you may not want to run your own mail server:
https://www.digitalocean.com/community/tutorials/why-you-may-not-want-to-run-your-own-mail-server
Hope that this helps!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.