Can send but not receive email (CentOS, Postfix)

August 6, 2013 41.3k views
I followed the instructions here to set up PostFix and I now have mail being sent from my website working just fine. https://www.digitalocean.com/community/articles/how-to-install-postfix-on-centos-6 However I cannot receive emails. I added an A and MX record for the mail server a few days ago. I would like to either set up multiple user accounts to run from outlook (need passwords on each etc. so may be more complex) or just have everything get forwarded to free gmail accounts. In postfix main.cf I have: virtual_alias_maps = hash:/etc/postfix/virtual in /etc/postfix/virtual I have a line for each intended email address and where it should forward e.g.: me@mydomain.com me@gmail.com Then I did this: # postmap /etc/postfix/virtual # service postfix reload But I get nothing, any ideas? Thanks
26 Answers
Check postfix's error logs - do you see any errors? Do you have a firewall running? Is port 25 open on your droplet? Are you sure you set up the MX/A records properly?
I have iptables configured as the digitalocean guide suggests and just checked the rules are there:

ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:110
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:995

I have the following DNS records:

A @ my.domain.ip.address
A mail.mydomain.com. my.domain.ip.address
MX 1 mail.mydomain.com.


Nothing in postfix error log
I wonder if the mail is going somewhere and I just dont know where, as it used to bounce but the last few times it didn't
Add this rule:

-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT

Try sending an email now - does that work?
i think he meant to put
-A INPUT -p tcp -m tcp --dport 25 -j ACCEPT
port 22 is for ssh, 25 is smtp.
still nothing

"Delivery to the following recipients has been delayed." is bounce message
Sorry, my bad. I meant port 25 instead of 22. Run this command locally:

telnet yourip 25

Are you able to connect?
Nope I can't telnet in from putty to my ip on port 25

Here's the full list of iptables rules:

http://pastie.org/private/s1tf5odmtffzzxbellq

I recently added the "-A OUTPUT -p tcp -m tcp --sport 25 -j ACCEPT" one to no avail.
Try sending mail to your droplet, from your droplet -- does that work?
I really don't think the firewall is the issue cos it still doesnt work if i stop iptables
Do you mean to mail a linux user?

Where does the mail go (or where is it supposed to go)?
I can't telnet to box even with iptables stopped
When I do on my server:

telnet localhost 25

I get...

Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.

What's the output of this command?

netstat -plutn | grep :25
Same happened with:

telnet 127.0.0.1 25

I think the localhost was using ipv6
sudo netstat -plutn | grep :25 gives:


tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 1285/master -
What's the output of this command?
ps wwaux | grep 1285
root 1285 0.0 0.1 78728 3228 ? Ss Aug06 0:03 /usr/libexec/postfix/master
myuser 5925 0.0 0.0 6376 700 pts/0 S+ 20:20 0:00 grep 1285
The mail I sent from my domain to my domain (redirected to gmail) with mailx worked - just found it in my gmail spam!

None of the emails I've sent from external domains have
Woohooooo it is now working! I was following some instructions to set up dkim keys for my outgoing mail and by the end of it my incoming mail was working too!

I'm not quite sure how/why though.
Awesome! Glad it worked :]

Having DKIM keys set up allows the mail server to verify that you're the real owner of the domain so that they don't go straight to spam.
Gone through the whole process, still cannot receive email. Emails are sent, but cannot receive. Here are my MX records:

A @ 198.199.125.224
CNAME www @
CNAME * @
NS NS1.DIGITALOCEAN.COM.
NS NS2.DIGITALOCEAN.COM.
NS NS3.DIGITALOCEAN.COM.

Followed Etel Sverdlov's tutorial on setting up Postfix & Cyrus on Centos 6.
i want to set that my droplet with many domains can forward email to external emails. i read and followed bunch od tutorials including postfix itself. set up seems very simple, but nothing works after almost 10+ hours of trying.
any one managed to set postfix mail forward9ing on cent os 6.5?

This solved it for me, for those searching the web for hours.

sudo vim /etc/postfix/main.cf
-- press i
-- go to inetinterfaces
-- set inet
interfaces to all
sudo service postfix restart

Have another answer? Share your knowledge.