LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Postfix, forwarding a copy of email based on header (https://www.linuxquestions.org/questions/linux-software-2/postfix-forwarding-a-copy-of-email-based-on-header-730624/)

ncicovic 06-04-2009 06:22 AM

Postfix, forwarding a copy of email based on header
 
I was wondering if there is a way to forward a copy of an incoming email, to another email, based on a "From:" field or subject on a postfix mail server.

I read a bit on postfix's header_checks, but anything similar to forwarding a copy of email would be the REDIRECT function in header_checks. This function can redirect an email to only one address, and I need to forward it to at least two addresses. REDIRECT doesn't also redirect to an alias.

On this mail server I have postfix and amavis with spamassassin and clamav as filters.

Anyone know of a way to accomplish this?

billymayday 06-04-2009 11:01 PM

Is the To: header to a local recipient?

ncicovic 06-05-2009 02:26 AM

Oops, i mean't the "From:" field. From field is not a local recipient.

farslayer 06-05-2009 08:06 AM

sounds like maybe a job for procmail, maildrop, or some other MDA (Mail Deliver Agent).

http://www.procmail.org/
Quote:

This is the home page of the procmail mail processing and SmartList mailing list suites. Procmail can be used to create mail-servers, mailing lists, sort your incoming mail into separate folders/files (real convenient when subscribing to one or more mailing lists or for prioritizing your mail), preprocess your mail, start any programs upon mail arrival (e.g. to generate different chimes on your workstation for different types of mail) or selectively forward certain incoming mail automatically to someone.

http://www.courier-mta.org/maildrop/
Quote:

maildrop optionally reads instructions from a file, which describe how to filter incoming mail. These instructions can direct maildrop to deliver the message to an alternate mailbox, or forward it somewhere else. Unlike procmail, maildrop uses a structured filtering language.

maildrop is written in C++, and is significantly larger than procmail. However, it uses resources much more efficiently. Unlike procmail, maildrop will not read a 10 megabyte mail message into memory. Large messages are saved in a temporary file, and are filtered from the temporary file. If the standard input to maildrop is a file, and not a pipe, a temporary file will not be necessary.


All times are GMT -5. The time now is 05:42 PM.