0

I setup Postfix a few days ago to deliver email bound for my host name remotely instead of locally as I want email sent to my remote [email protected] account without trying to be sent locally. However, this causes a problem as it tries to send local bound mail(root) to my remote server as well ([email protected]).

I would like E-mail bound for [email protected] to be sent to the remote server(GMail Apps in this case) and everything else sent locally(using the alias file perhaps), is this possible?

My current configuration: http://pastebin.com/htwSQB61

4

3 Answers 3

1

Okay I finally managed to solve this and it was quite simple really:

main.cf:

mydestination = localhost.$mydomain, localhost
virtual_alias_maps = hash:/etc/postfix/virtual

/etc/postfix/virtual:

root root@localhost

As all local accounts usually get aliased to root this solution works pretty well as instead of trying to send all the mail remotely it will send it locally. If you have an account called admin or something else you don't want going locally just make sure it's not aliased to root.

0

I may be misunderstanding the question, but the following line in /etc/aliases will cause all may sent to the admin user to be forwarded to the specified address (run newaliases after editing).

admin: [email protected]
5
  • I've tried this however I always get the following error: to=<[email protected]>, orig_to=<admin>, relay=local, delay=1.1, delays=0.23/0.05/0/0.84, dsn=5.1.1,status=bounced (unknown user: "admin")
    – Ben Scobie
    Jun 20, 2012 at 18:24
  • @BenScobie Did you run newaliases and then service postfix reload after editing the file?
    – mgorven
    Jun 20, 2012 at 18:29
  • Okay I made an "admin" account and now the e-mail is sent, but it is still going locally, probably because of the $myhostname in mydestination. I need to somehow get it to ignore that when doing an alias lookup.
    – Ben Scobie
    Jun 20, 2012 at 21:51
  • Check in main.cf if /etc/aliases is used. Something like alias_maps = hash:/etc/aliases Sep 11, 2012 at 13:41
  • you need to add this line in /etc/postfix/aliases according to your main.cf. Sep 11, 2012 at 13:44
-1

Try this: http://www.cyberciti.biz/tips/howto-postfix-masquerade-change-email-mail-address.html I have used this solution before and it worked.

1
  • I'm not 100% sure that this will solve my problem, it seems to solve something completely different.
    – Ben Scobie
    Jan 13, 2012 at 19:06

You must log in to answer this question.

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