On 10/20/2010 09:04 PM, John Watson wrote:
Hello,
I am using postfix in conjunction with squirrelmail to build a
business application. One of the requirements that I have is that when
an email is received in one of the postfix mail boxes an alert is
generated. In our case we will be sending a standard message to
another email but in general we might want to run arbitrary code when
messages are received by postfix.
To send a copy of all mail to additional recipients, see always_bcc:
http://www.postfix.org/postconf.5.html#always_bcc
It seems that some of the work that has been done with virus scanners
uses a server hook to examine all the messages that pass through the
server. Can anyone tell me what that is called or provide a pointer to
more detail and is this the best way to solve a problem like this?
You're probably talking about content_filter, but there are in fact
many, many ways to implement such a scenario.
My choice would be one of:
- always_bcc to a local command alias
- always_bcc to a custom pipe(8) transport
The latter has the most flexibility in the command(s) executed - you can
execute basically anything your system has (but not as root), with all
relevant message parameters as variables to pass to the command(s).
Reading:
Architecture overview - do not skip this!
http://www.postfix.org/OVERVIEW.html
Local delivery and command execution: http://www.postfix.org/local.8.html
Transport maps and manipulation : http://www.postfix.org/transport.5.html
Pipe(8) command delivery: http://www.postfix.org/pipe.8.html
--
J.