I can't receive e-mails

November 20, 2013 11.7k views
Hello, I tried to contact the support but it seems they can't help with config issues. I hope someone will be able to help here. I followed this tutorial https://www.digitalocean.com/community/articles/how-to-install-postfix-on-centos-6 and I only have email redirects into /etc/postfix/virtual I'm testing with the email address test@xxxxxxxx.com (redirecting to test@gmail.com) I can: - send an email from ssh using the command line "mail test@xxxxxxxx.com" - receive this email on my Gmail account - send an email from Gmail from test@xxxxxxxx.com to test@xxxxxxxx.com (I think so) - send an email from Gmail from test@gmail.com to test@xxxxxxxx.com (I think so) but I can't : - receive the emails from Gmail on my Gmail account Also, the emails sent through the ssh are received with the sender root@mail.xxxxxxxx.com. Why not test@xxxxxxxx.com? This is my DNS config: $TTL 1800 @ IN SOA NS1.DIGITALOCEAN.COM. hostmaster.xxxxxxxx.com. ( 1384969598 ; last update: 2013-11-20 17:46:38 UTC 3600 ; refresh 900 ; retry 1209600 ; expire 1800 ; ttl ) IN NS NS1.DIGITALOCEAN.COM. NS NS2.DIGITALOCEAN.COM. NS NS3.DIGITALOCEAN.COM. MX 5 mail MX 1 ASPMX.L.GOOGLE.COM. MX 5 ALT1.ASPMX.L.GOOGLE.COM. MX 5 ALT2.ASPMX.L.GOOGLE.COM. MX 10 ASPMX2.GOOGLEMAIL.COM. MX 10 ASPMX3.GOOGLEMAIL.COM. @ IN A xxx.xxx.xxx.xxx www CNAME @ @ TXT "v=spf1 ip4:xxx.xxx.xxx.xxx include:_spf.google.com -all" I get this email back from google Delivery to the following recipient failed permanently: test@xxxxxxxx.com Technical details of permanent failure: Google tried to deliver your message, but it was rejected by the server for the recipient domain xxxxxxxx.com by aspmx.l.google.com. [2607:f8b0:4002:c01::1a]. The error that the other server returned was: 550-5.1.1 The email account that you tried to reach does not exist. Please try 550-5.1.1 double-checking the recipient's email address for typos or 550-5.1.1 unnecessary spaces. Learn more at 550 5.1.1 http://support.google.com/mail/bin/answer.py?answer=6596 8si5260891yhq.157 - gsmtp Thank you for your help
18 Answers
Technical details of permanent failure:
Google tried to deliver your message, but it was rejected by the server for the recipient domain xxxxxxxx.com by aspmx.l.google.com. [2607:f8b0:4002:c01::1a].

This is a big indicator of your problem, I suggest you look over your aliases and make sure that the email address you're forwarding to is the correct one.
Hi,

I just checked the file /etc/postfix/virtual, the redirect is here.
Then I ran "postmap /etc/postfix/virtual" which displayed no error and restarted postfix "service postfix restart."
maillog doesn't show any error
This is how I wrote the redirects in this file:
test@xxxxxxxx.com test@gmail.com

I checked /etc/postfix/main.cf I have
virtual_alias_maps = hash:/etc/postfix/virtual
This line wasn't in the original config, I added it when I followed the tutorial.

I'm still getting the same error
Post the contents of your /etc/hosts file on Pastebin and share the link with us.

You may also want to compare your SPF record through one generated at easySPF: an Ajax enabled SPF Wizard.
One other thing that might be the case is that the DNS MX records are not correct. You have them set for the Google email addresses, but that is only if you are using the Google Apps service, typically for small businesses and such. If you do not have a Google Apps account, it may be why Google is complaining about the email account not existing.

If you are just looking to forward your mail to one of the free gmail accounts (not Google Apps), you may wish to consider reverting the MX entries back to MX 0 , and then let postfix do the forwarding.

"If you are just looking to forward your mail to one of the free gmail accounts (not Google Apps), you may wish to consider reverting the MX entries back to MX 0 , and then let postfix do the forwarding."
This is my new DNS settings
================================================================
$TTL 1800
@ IN SOA NS1.DIGITALOCEAN.COM. hostmaster.xxxxxxxx.com. (
1384983418 ; last update: 2013-11-20 21:36:58 UTC
3600 ; refresh
900 ; retry
1209600 ; expire
1800 ; ttl
)
IN NS NS1.DIGITALOCEAN.COM.
NS NS2.DIGITALOCEAN.COM.
NS NS3.DIGITALOCEAN.COM.
MX 5 mail
MX 0 xxxxxxxx.com.
@ IN A xxx.xxx.xxx.xxx
www CNAME @
@ TXT "v=spf1 ip4:xxx.xxx.xxx.xxx include:_spf.google.com -all"

================================================================
In the hosts file, I have

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 www.xxxxxxxx.com xxxxxxxx.com www.2.co 2.co www.3.com 3.com www.4.com 4.com www.5.com 5.com
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
xxx.xxx.xxx.xxx www.xxxxxxxx.com xxxxxxxx.com www.2.co 2.co www.3.com 3.com www.4.com 4.com www.5.com 5.com
RE: Your SPF record "v=spf1 ip4:xxx.xxx.xxx.xxx include:_spf.google.com -all"

Have you reviewed How To use an SPF Record to Prevent Spoofing & Improve E-mail Reliability and/or How To Create a SPF Record For Your Domain with Google Apps?

Looks like you're missing the mx mechanism. I'd also try changing -all to ~all.
by Keshav Pareek
Here we'll show you how to create a SPF record for your domain with Google Apps.
I'm assuming that you have tried this already, but if you have not, you may wish to look into /var/log/maillog for any error messages, etc. It has been a while since I have used postfix, but I think that this is where postfix logs any errors. My suspicion is that this may be more related to the postfix configuration than with the DNS settings.
"... the emails sent through the ssh are received with the sender root@mail.xxxxxxxx.com. Why not test@xxxxxxxx.com?"

What are the contents of /etc/postfix/virtual?
Thanks all for your help, still trying to figure out why it isn't working.

This is what I get when using the dig command:

dig xxxxxxxx.com mx

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> xxxxxxxx.com mx
;; global options: +cmd
;; Got answer:
;; ->>HEADER<;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;xxxxxxxx.com. IN MX

;; ANSWER SECTION:
xxxxxxxx.com. 1800 IN MX 5 mail.xxxxxxxx.com.
xxxxxxxx.com. 1800 IN MX 0 xxxxxxxx.com.

;; Query time: 190 msec
;; SERVER: 4.2.2.2#53(4.2.2.2)
;; WHEN: Thu Nov 21 19:57:56 2013
;; MSG SIZE rcvd: 66

================================================================

In /etc/postfix/virtual, I only have general redirects like
@xxxxxxxx.com test@gmail.com

I've also changed -all to ~all but shouldn't I remove this google thing since I'm not using Google apps but just redirecting to free gmail accounts?
Here is what my config looks like:

/etc/postfix/main.cf
http://pastebin.centos.org/5951/
Add a DNS record as follows:

CNAME mail @
"... the emails sent through the ssh are received with the sender root@mail.xxxxxxxx.com. Why not test@xxxxxxxx.com?"

That's normal. You just need to set the From: header to whatever you want it to be:
mail [your arguments here, such as -s for the subject and the recipient's email address] -- -f sender@bar.com

Example:
mail -s "Test email" your@email.address -- -f noreply@yourdomain.com
ok thanks all for your help. it seems to be working now :)
Hi,
I was wrong it isn't working :(
When I looked for the email in gmail, I actually found the sent email. I thought it was what I received haha


Can someone help?
Maybe with this?

/etc/postfix/main.cf
http://pastebin.centos.org/5951/

Thank you
By the way, the error message from google is different from my 1st post.

Technical details of temporary failure:
The recipient server did not accept our requests to connect. Learn more at http://support.google.com/mail/bin/answer.py?answer=7720
[(0) xxxxxxx.com. [xxx.xxx.xxx.xxx]:25: Connection refused]
[(5) mail.xxxxxxx.com. [xxx.xxx.xxx.xxx]:25: Connection refused]

When I follow the Google link and go to their mx configuring page I get a wrning on 'SPF MUST allow Google servers to send mail on behalf of domain.' but the data that provides google is 100% the same I have in my config
By chance, have you taken a look at How To Set Up a Postfix E-Mail Server with Dovecot? I realize that it's written for Debian, but with How To Install Postfix on CentOS 6, you should be able to easily apply it to your situation.
by Etel Sverdlov
This tutorial explains how to install postfix and cyrus with yum, how to configure postfix, how to configure cyrus, how to install mailx, and how to send a test email. Postfix is free open source Mail Transfer Agent which works to route and deliver email.This tutorial should help you set up a mail server on a centos droplet.
Yes, I used https://digitalocean.com/community/articles/how-to-install-postfix-on-centos-6 to install everything.
by Etel Sverdlov
This tutorial explains how to install postfix and cyrus with yum, how to configure postfix, how to configure cyrus, how to install mailx, and how to send a test email. Postfix is free open source Mail Transfer Agent which works to route and deliver email.This tutorial should help you set up a mail server on a centos droplet.
You need to create MX records for your domain:

MX, priority 10, hostname: mail
Have another answer? Share your knowledge.