13 messages in net.sourceforge.lists.courier-maildropRe: [maildropl] Vacation scripting fo...
FromSent OnAttachments
Todd LyonsOct 13, 2005 1:59 pm 
Rolan YangOct 13, 2005 2:15 pm 
Todd LyonsOct 13, 2005 2:50 pm 
moussOct 13, 2005 6:27 pm 
Todd LyonsOct 14, 2005 11:37 am 
moussOct 14, 2005 3:39 pm 
Todd LyonsOct 14, 2005 4:05 pm 
moussOct 15, 2005 5:45 am 
Todd LyonsOct 17, 2005 10:48 am 
Ralf HildebrandtOct 18, 2005 5:21 am 
Todd LyonsOct 18, 2005 8:51 am 
Ralf HildebrandtOct 18, 2005 8:54 am 
Todd LyonsOct 19, 2005 12:12 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [maildropl] Vacation scripting for maildropActions...
From:Todd Lyons (tly@ivenue.com)
Date:Oct 19, 2005 12:12:52 pm
List:net.sourceforge.lists.courier-maildrop

Todd Lyons wanted us to know:

Hey all, I've been putting together a little bit of scripting to do vacation. It started from the example in the maildropex man pages and

http://gentoo-wiki.com/Maildrop_configuration#Autoreply

Seems like it does one less shell spawn, because it generates and sends the message all in one shell. I'll experiment with it and with using gdbm manually (which seems to accomplish the same thing, though I do like mailbot handling that part outside of the scripting).

If mailbot would exit with errorlevels to indicate status or what it did, it would be the perfect solution. But it doesn't, so it isn't (at least not for me).

I ended up going with this solution. Bulky? Yes. But it does exactly what I'm looking for. I think I will work on adapting mailbot to do these things that I need (errorlevels, ability to choose between user generated and machine generated headers, and additional header checks). If not welcomed by the author (Mr Sam?), I'll just use it myself and leave a patch up for download on my site I guess.

In the mean time, here is the maildroprc that we're using (about to be in production) :

# Global maildrop filter file

logfile "/var/log/maildrop.log"

DEFAULT="$HOME/Maildir/"

`test -f $HOME/vacation.msg` if ( $RETURNCODE == 0 ) { log "Vacation mode, email delivery to $LOGNAME:" cc $DEFAULT

/^Precedence:.*/ if ( $MATCH =~ /bulk|list|junk/ ) { log "No vacation message: $MATCH" exit }

/^(X-BeenThere|X-Loop|Mailing-List|Auto-Submitted):.*/ if ( $MATCH ) { log "No vacation message: $MATCH" exit }

/^(From|Return-Path):.*/ if ( $MATCH =~ /MAILER-DAEMON/ ) { log "No vacation message: $MATCH" exit }

/^X-Spam-Status:.*/ if ( $MATCH =~ /Yes/:D ) { log "No vacation message: $MATCH" exit }

/^To: !.*/ TO=tolower($MATCH2)

/^Cc: !.*/ CC=tolower($MATCH2)

if ( ! ( ( $TO =~ /$LOGNAME/ ) || ( $CC =~ /$LOGNAME/ ) ) ) { log "No vacation message, not in To or Cc" exit }

xfilter "reformail -r -t -I 'From: $LOGNAME' -I 'X-Loop: Vacation for $LOGNAME'
-I 'Reply-To: $LOGNAME' -I 'Auto-Submitted: auto-replied' -I 'Precedence: bulk'" /^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 ) { log "Already sent vacation message to $MATCH\n" exit } log "Vacation message to $MATCH:" to "| (cat - ; echo ''; cat vacation.msg) | $SENDMAIL -t" } else { log "Normal mail delivery for $LOGNAME:" to "$DEFAULT" }