Nezer Zaidenberg:
> hi
> 
> I want all the emails I receive to be sent to a script.
> This script will also "swallow" all emails so no further delivery will be
> necessary
> (basically process them. modify some values in DB2 then wait for next email)
> 
> I understand that it is best if i use the pipe(8) or perhaps spawn(8)
> commands.
> 
> Questions
> 1) I don't seem to be able to start the script.

To run the script from Postfix:

- The first line must specify "#!/path/to/interpreter"
- You must "chmod a+rx" the file.

To test the script:

    $ /path/to/script  < inputfile

> 2) Once I start the script how do I get the actual email content?

You use the Postfix pipe(8) program to run the script, and the
script receives the message on the standard input stream.
http://en.wikipedia.org/wiki/Standard_streams

Postfix logs errors to the maillog file.

> do you have an example for script and master.cf file that calls it?

There is one in http://www.postfix.org/FILTER_README.html (but
that script was written for a different purpose, filtering mail
and sending it back into Postfix).

But, if you have to ask all these questions, then you probably
should not be writing script that receive random data from the
Internet. It is an unsafe place.

        Wietse

Reply via email to