Link to home
Start Free TrialLog in
Avatar of ivanvega
ivanvega

asked on

How to make Postfix relay mail to the servers specified as MX, not to itself

Hi,

I have a machine with Postfix that I want to use for one of my scripts to send mail, to the same domain. It's kind of confusing for me, but here it is:

Let's say the machine name is mydomain.com.mx, and the MX entries of the domain are setup for Google Apps (so Google handles all my mail).

So, currently if I try to send mail from inside the machine, I get a 'user not found' error from postfix, since it tries to deliver mail locally, instead of using the servers specified in the DNS.

Is there an easy way to fix this?

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Kerem ERSOY
Kerem ERSOY

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ivanvega
ivanvega

ASKER

Hi,

I tried your first suggestion and it still doesn't work:

"Recipient address rejected: User unknown in local recipient table"

And my system doesn't have a /etc/postfix/virtual file.

Thanks.
It seems if I change myhostname and mydomain too (nullclient.mydomain.com.mx, mydomain.com.mx), it now works.

relayhost also accepts the actual domain, instead of a given MX host, and then it will select the right MX entry. Nice.

Thanks!
ok. Don't forget to modify your /etc/hosts too. Remove your hostname as an alias to localhost add its own address such as:

127.0.0.1             localhost.localdomain localhost
<ip_of_your_ethernet>      nullhost.mydomain.mx   nullhost

save & exit.

You can just create /etc/postfix/virtual if it does not exist. But in the default  configuration there exists a virtual file with lots of commensts. It is possible that your default config is not in /etc/postfix. if it is just create yourself. it is a text file afterall..