Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 sales@mcdonalds.com and send mail locally from the server using roundcube. This works. We can send mail to cnn.com we can send mail to serverfault.com we can email any/everyone.

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

So I cannot email info@mcdonalds.com I cannot email bob@mcdonalds.com I cannot email support@mcdonalds.com

It gives the error:

SMTP Error (450): Failed to add recipient "bob@mcdonalds.com" (4.1.1 : Recipient address rejected: User unknown in virtual mailbox table).

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

So how to I tell the server for any mail going to mcdonalds.com for bob@mcdonalds.com to send to my external mail server and NOT to lookup on the local www box we set up with zpanel.

Any ideas?

share|improve this question
add comment

1 Answer

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.

share|improve this answer
    
tried that.. but no luck. Added the line to transport and then did the postmap.. –  orlandoresorts Mar 28 '13 at 13:27
    
error was Mar 28 09:24:51 server postfix/pickup[10079]: DC00615A20D7: uid=0 from=<sender@mcdonalds.com> Mar 28 09:24:51 server postfix/cleanup[10094]: DC00615A20D7: message-id=<20130328142451.DC00615A20D7@www.mcdonalds.com> Mar 28 09:24:51 server postfix/qmgr[10080]: DC00615A20D7: from=<sender@mcdonalds.com>, size=322, nrcpt=1 (queue active) Mar 28 09:24:52 server postfix/pipe[10085]: DC00615A20D7: to=<recipient@mcdonalds.com>, relay=dovecot, delay=0.18, delays=0.12/0/0/0.07, dsn=4.1.1, status=SOFTBOUNCE (user unknown) –  orlandoresorts Mar 28 '13 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 –  Laurentiu Roescu Mar 28 '13 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. –  Laurentiu Roescu Mar 28 '13 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? –  orlandoresorts Mar 28 '13 at 14:29
show 9 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.