3

I have postfix set-up on my Debian VPS, I can:

  • send emails
  • receive emails

on my server

But forwarding emails from my server to gmail does not work!

I configured google's DNS through /etc/resolv.conf

I can ping google.com and with dig I also find gmail MX records. But when my server tries to forward email to gmail (setup with /etc/aliases) I get the following error:

postfix/smtp[20280]: 825E117BA8A80: to=<john_doe@gmail.com>, orig_to=<xxx@xxx.yyy>, relay=none, delay=40, delays=0/0.01/40/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=gmail.com type=MX: Host not found, try again)

What am I missing? Any help will be greatly appreciated!

mgorven
  • 30,615
  • 7
  • 79
  • 122
Domagoj
  • 31
  • 3

2 Answers2

4

You are almost certainly running with postfix chrooted. You need to copy /etc/resolv.conf into the chroot as well. On Debian that should be /var/spool/postfix/ - so /var/spool/postfix/etc/resolv.conf.

You may want to check that you don't have SYNC_CHROOT turned off in /etc/default/postfix - it default's to yes - so just stopping and starting postfix with the init script should copy the new /etc/resolv.conf into the right location:

/etc/init.d/postfix stop /etc/init.d/postfix start

You can check if you are running chrooted by looking for any 'y' in the chroot column in /etc/postfix/master.cf

Bron Gondwana
  • 1,738
  • 3
  • 12
  • 15
  • This happened to me because I was running postfix inside docker. The `/var/spool/postfix/etc/` directory didn't exists, so I created it and copied the `resolv.conf` there. After that, it worked. – lepe Jan 18 '23 at 03:05
1

Your name resolution setup is broken. Repair it. First have a look into /etc/resolv.conf.

mailq
  • 17,023
  • 2
  • 37
  • 69