Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm using Ubuntu 12.04 with postfix configured as satellite system that relays outgoing mail to Gmail. For sake of example, my registered domain is example.com I want root cronjobs' error output to be mailed to my real david@example.com inbox. I have this relay working correctly.

But these root cronjobs are set by default to email to root@example.com which isn't a real email address. I have in my /etc/aliases:

root: david@example.com

example.com isn't listed in postfix's main.cf's mydestination so postfix doesn't think this mail is local. It bypasses processing via /etc/aliases and tries to send to root@example.com.

A workaround is adding MAILTO=david at the top of each cron file. But there are many. Another workaround is to setup root@example.com as a real inbox that forwards to david@example.com. Is there a better way? I.e. is there a way to relay emails that have local domains but still process their addressee with /etc/aliases?

share|improve this question
    
Side-note: I would recommend nullmailer if you don't need a full-fledged MTA for other purposes. –  0xC0000022L May 4 at 23:37

2 Answers 2

It looks to me like the postfix myorigin value is set to example.com. On Debian (not 100% certain about Ubuntu) that is controlled by default in /etc/mailname.

The value of myorigin is used as the domain part when messages are prepared. This should be set to something that is in mydestination.

If those are set correctly then you'll get the behavior you're expecting from your configured aliases.

share|improve this answer

You have to define a relayhost - in your case probably the Gmail SMTP server.

This relayhost will get any mail not considered local (instead of trying to contact the mailrelay for each domain directly).

share|improve this answer

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.