Carlos Lorenzo Matés wrote:

Okay, I finally realized just what you wanted to do. This is a script I
adjusted for your purpose.

You need to add error handling to your faxmail routine to achieve a robust
transport.


#-----------------------------------------------------
#!/bin/sh
# I set this up in /var/lib/filter
INSPECT_DIR=/var/lib/filter

# Exit codes from <sysexits.h>
EX_TEMPFAIL=75
EX_UNAVAILABLE=69

# Clean up when done or when aborting.
trap "rm -f in.$$" 0 1 2 3 15

# Start processing.
cd $INSPECT_DIR || {
     echo $INSPECT_DIR does not exist; exit $EX_TEMPFAIL; }

cat >in.$$ || {
     echo Cannot save mail to file; exit $EX_TEMPFAIL; }

# Specify your content filter here.
# filter <in.$$ || {
#   echo Message content rejected; exit $EX_UNAVAILABLE; }

  #owner sender
  owner=`echo $2|cut -f 1 -d"@"`

#destination is the user
  destination=$1

  faxmail -o $owner -d -n $destination <in.$$

exit $?
#-----------------------------------------------------
--



Thank you very much, Sandy, I will try with your script on monday, as i need this in my job.

just to enhance my knowledge, could you explain a bit this sentences please?


 cat >in.$$ || {
      echo Cannot save mail to file; exit $EX_TEMPFAIL; }

I assume this gets the piped mail into "in.PID"

The mail gets piped into the file or if this is not possible the script reports the problem and sets exit code to tempfail and exits.

I need no content filter, as faxmail parses teh mail contents and convers teh multiparts to postscripts

That script is taken from the example of the simple filter script of the postfix documentation. The part with the content filter is commented out to show where the content filter should be called.

In your case I would probably check the error code of faxmail and report back to the sender if the fax was sent or not.


faxmail -o $owner -d -n $destination <in.$$

then the way to pass the piped mail is with the < in.$$ saved previously, rigth?

Yes.

how should i call this script form master.cf like i was calling mine?

Exactly as you have shown. Otherwise the script parameters probably would not be $1 and $2.
--
Sandy

List replies only please!
Please address PMs to: news-reply2 (@) japantest (.) homelinux (.) com

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to