1

I'm trying to get postfix to forward email to my domain which is hosted by gmail. As I don't have any users on my server nor do I want to.

Here's how I have things set up. Let's say you and I have a domain called mcdonalds.com.

The registrar has mcdonalds.com MX records pointing to gmail. Everything works for like a year.

Now we set up a server to host a website.

Then we create a mail account called [email protected] and send mail locally from the server using roundcube.

This works.

We can send mail to cnn.com, to serverfault.com or to any/everyone.

BUT we cannot send mail to our own domain, mcdonalds.com.

So I cannot email to [email protected], to [email protected] or to [email protected].

It gives the following error:

SMTP Error (450): Failed to add recipient "[email protected]" (4.1.1 <[email protected]>: Recipient address rejected: User unknown in virtual mailbox table).

I'm guessing because it is looking at the local server to find the mailbox, which doesn't exist.

So how to I tell the server for any mail going to mcdonalds.com for [email protected] to send to my external mail server, and not to lookup on the local www box we set up with zpanel?

Any ideas?

1 Answer 1

1

You can use transport for that (http://www.postfix.org/transport.5.html).

put in /etc/postfix/transport

mcdonalds.com   :aspmx.l.google.com

Don't forget to run postmap /etc/postfix/transport after that.

15
  • tried that.. but no luck. Added the line to transport and then did the postmap.. Mar 28, 2013 at 13:27
  • error was Mar 28 09:24:51 server postfix/pickup[10079]: DC00615A20D7: uid=0 from=<[email protected]> Mar 28 09:24:51 server postfix/cleanup[10094]: DC00615A20D7: message-id=<[email protected]> Mar 28 09:24:51 server postfix/qmgr[10080]: DC00615A20D7: from=<[email protected]>, size=322, nrcpt=1 (queue active) Mar 28 09:24:52 server postfix/pipe[10085]: DC00615A20D7: to=<[email protected]>, relay=dovecot, delay=0.18, delays=0.12/0/0/0.07, dsn=4.1.1, status=SOFTBOUNCE (user unknown) Mar 28, 2013 at 13:28
  • You could leave local_recipient_maps empty in main.cf but this would not be a good idea because it will forward to gmail all emails for your domain, even if recipients does not exist. If this server is is exposed in internet it could be a big problem. You could list all existing recipients in a file and use this file in local_recipient_maps (something like local_recipient_maps = hash:/etc/postfix/usernames). postfix.org/LOCAL_RECIPIENT_README.html Mar 28, 2013 at 13:51
  • You could also change mydomain in main.cf to something like server.mcdonalds.com. This way the server will not think that mails for @mcdonalds.com are for itself and it will forward them to MX. Mar 28, 2013 at 13:58
  • I did try that too beforehand! (changing the mydomain to xzy.com I made up.. and no luck :( ) The local recipent maps is already blank. (the email addresses are fixed.. 4 addresses . But I don't want to staticly assign addresses just in case I add more people.. but the usernames wouldn't work cuz I have no local mailboxes... right? Mar 28, 2013 at 14:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .