Florian Lindner writes:
Hello,I have this piece of code in my .mailfilter: MATCH1 = "None" /^X-Flofify-Class: (.*)$/ class = $MATCH1 log "Class: $class" if ($class eq "None") to "$MDIR/[email protected]" else to "$MDIR/[email protected]/.$class"But when there is no match at all (e.g. no X-Flofify-Class header existing) the value of MATCH1 is not None but still the one from the previous regexp operation (somewhere else in my code).How can I set a default value if not match is found?
This seems to work as expected for me: logfile "maildrop.log" /Subject: (.*)/ log "Subject match: $MATCH1" MATCH1="None" log "Match reset: $MATCH1" /Snorkle: (.*)/ log "Match fail: $MATCH1" Results in: Subject match: Original subject line Match reset: None Match fail: None Date: Mon Feb 17 09:17:16 2014 From: Subj: Original subject lineFile: ./Maildir/. (44)
But having said that, this is a bit awkward way to do this. You should use an if statement:
if (/^X-Flofify-Class: (.*)$/)
{
whatever=$MATCH1
and so on.
pgpKQk2huw7BQ.pgp
Description: PGP signature
------------------------------------------------------------------------------ Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________ courier-users mailing list [email protected] Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
