map in virtual_alias_maps file:

    u...@foo.com u...@gmail.com

(then postmap this file).  The message sent to u...@foo.com won't
reach into mailbox, but just forwarded to gmail.

How can I setup it to both reach local mailbox and forwarding?

This is a bad idea.  Don't do this.  Forwarding spam to gmail, or mail
from external senders with SPF policies, ... will fail to be delivered,
and will tarnish your server's "reputation".

It can of course be made to "work" (in the sense of queueing the mail
for delivery), but really, don't.


Thanks Victor. I know this is not good idea to forward messages to external systems. But for tech way, what's the right setup to both keep messages in local mailbox and forward them to another address?

From http://www.postfix.org/virtual.5.html,
note "Virtual  aliasing  is  recursive; to terminate recursion for a specific address, alias that address to itself."

Not 100% sure but try this:

map in virtual_alias_maps file:

u...@foo.com u...@foo.com u...@gmail.com
u...@gmail.com u...@gmail.com

The second line is probably not strictly necessary but may terminate the recursive evaluation of aliases.

You will also need to set up Sender Rewriting Scheme (SRS) or similar, or forwards from SPF domains will be blocked at the other end anyway.



--
This email has been checked for viruses by AVG antivirus software.
www.avg.com
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to