[courier-users] Re: Vacation Filter Example
Brought to you by:
mrsam
From: Alessandro V. <ve...@ta...> - 2001-09-29 10:07:35
|
Steve Manning writes: > I'm looking at the vacation script example from the maildropex.html page, > but I can't find an example of what should go in the vacation.msg file. > > Should this be just the message body or a complete message with headers or > a complete message minus the To: header? > > This is the script: > > cc /home/vmail/maildirs/james > xfilter "/usr/local/bin/reformail -r -t" reformail prepares an answer and then xfilter puts its output on your script stdin. Basically, it only writes the headers and doesn't seem to do anything with body or attachments. Please keep in mind that you'll be using the return address. E.g. experiment with something like From: "`cat /etc/passwd | sendmail me@somewhere`" <me@somewhere> To: james@yoursite Subject: whatever and similar stuff. Also, getaddr may insert newlines if multiple comma separated addresses are found; recall that the MATCH variable is set as a side effect of the regex. > /^To:.*/ > getaddr($MATCH) =~ /^.*/; > > MATCH=tolower($MATCH) > flock "/home/vmail/jd.holiday.lock" { > `fgrep -iqx "$MATCH" /home/vmail/jd.holiday.lst 2>/dev/null || \ > { echo "$MATCH" >> /home/vmail/jd.holiday.lst ; exit 1 ; } ` > } > > if ( $RETURNCODE == 0 ) > { > exit > } The following line is a nice puzzle, as the argument to 'to' consists of two quoted strings that are concatenated. The first 'cat' puts the headers from stdin that were prepared by reformail. 'echo' with no arguments puts an empty line, in case reformail didn't do it. Then you go with your holiday stuff: it is the body of a message. > > to "| ( cat - ; echo ""; cat /home/vmail/jd.holiday.msg) | $SENDMAIL" > > TIA > > Steve Ciao Ale |