Devin Rubia schrieb:
On Wed, Jun 14, 2006 at 12:51:45PM +0200, M. Bobkiewicz wrote:
Hi,
I?m trying to setup an vacation message on a postfix/courier imap
Maildir server. On the internet I found the following script:
$DEFAULT
xfilter "reformail -r -t"
/^To:.*/
getaddr($MATCH) =~ /^.*/;
MATCH=tolower($MATCH)
flock "vacation.lock" {
`fgrep -iqx "$MATCH" vacation.lst 2>/dev/null || { \
echo "$MATCH" >>vacation.lst ; \
exit 1 ; \
} `
}
if ( $RETURNCODE == 0 )
exit
to "| ( cat - ; echo ''; cat vacation.msg) | $SENDMAIL"
When I activate the script in a user directory, the vacation.lock file
appears, the sender is added to the vacation.lst (the list is growing
when there came in several mails from several locations) but the mail
itself disappears and also there no response is send back to the sender.
Nothing in the maillogs, when I remove the .mailfilter file the mail is
delivered to the user as expected. Anything wrong with the script?
Damn.
Is there anything wrong? I really don't know where to begin. That is
one nasty piece of work.
That script makes no allowances for actually delivering the message to
the recipient. Here's the workflow as I see it:
- Reformat the message into headers for an auto reply (This effectively
discards the entire contents of the original message).
- Find the "To" address in the generated headers and drop it in a list of
senders.
- If the "To" address is not on the list, send an auto reply.
If that first line had to be:
cc "$DEFAULT"
Then the recipient might have gotten a copy.
HOWEVER:
The whole thing could easily be replaced using mailbot (Why won't
people use the tools given to them?).
cc "| mailbot -t vacation.msg -d vacation.db -D 1 \
-A 'From: us...@example.com' /usr/bin/sendmail -f ''"
to "$DEFAULT"
Replace the number in "-D 1" with the number of days you want between
auto-replies (ex. "-D 7" for a week).
Thanks for the reply. Now it works. For some reason I had to add the -t
parameter to the sendmail call. Without that the response wasn´t send
and there was a "No recipients specified" error in the postfix log.
Best regards,
Mike Bobkiewicz