When starting a new thread, please do not reply to an existing one; make it a new message. This one contains irrelevant threading information in the headers, which causes a problem for thread-aware mail readers. Thanks.
On Mon, Feb 20, 2012 at 02:35:10PM +0100, Dragan Zubac wrote: > Postfix is running on a server with domain : domain.com I'm also willing to bet that you do not own domain.com. Don't use real Internet names as examples. Example.TLD in almost any top-level domain, or {first,second,third,...}.example are safe. > Is it possible to have Postfix configured to forward emails only > if To,CC or BCC fields contain the following domains : > > - test.com > - example.com By "forward" you probably mean you're using virtual_alias_maps with target addresses going externally. Another thing: you should always describe the actual problem you are trying to solve. Here you gave only your idea for a solution. The answer is no. Postfix is not capable of making routing decisions based on mail content. There are header/body_checks(5) mechanisms available, but in general, you should not make routing decisions based on mail content. And in this case there is no way to make that conditional decision anyway. Your only possible answer to do what you asked is an external content filter as SMTP proxy. http://www.postfix.org/SMTPD_PROXY_README.html > Forwarding emails that has To,CC or BCC fields containing There is no such "field" as BCC. If a client submits mail with a header, "^Bcc: ", the MTA will strip it. > destination addresses for other domains than specified should > be rejected. Also not a good idea. Look at this mail for an example. The headers tell us it was To: postfix-users@postfix.org, and neither to you nor me. Yet we both see it in our mailboxes! If I correctly guessed the real goal above, there is no simple answer for you. Indeed, same envelope forwarding to addresses outside your control is not safe and workable in this day and age. -- http://rob0.nodns4.us/ -- system administration and consulting Offlist GMX mail is seen only if "/dev/rob0" is in the Subject: