[Postfixadmin-devel] Requesting comment on a modification of vacation.pl
Brought to you by:
christian_boltz,
gingerdog
From: Tanstaafl <tan...@li...> - 2011-01-17 17:51:55
|
Hello, After conversing with Christian on irc, I have attempted a slight modification of the section of vacation.pl that deals with deciding whether or not to send a vacatiopn response based on the headers. I am not sure at all whether this will work as I think oir expect, so would appreciate some comments. What I'm after is a reasonable way to add simple strings that will cause the vacation message to NOT be sent... Here is what I have so far: > # Take headers apart > $cc = ''; > $replyto = ''; > > # To Add: > # elsif (/^x\-assp\-spam:\s+yes/i) { $logger->debug('X-Assp-Spam: Yes found; ignoring'); exit (0); } > > $logger->debug("Script argument SMTP recipient is : '$smtp_recipient' and smtp_sender : '$smtp_sender'"); > while (<STDIN>) { > last if (/^$/); > if (/^\s+(.*)/ and $lastheader) { $$lastheader .= " $1"; next; } > elsif (/^from:\s*(.*)\n$/i) { $from = $1; $lastheader = \$from; } > elsif (/^to:\s*(.*)\n$/i) { $to = $1; $lastheader = \$to; } > elsif (/^cc:\s*(.*)\n$/i) { $cc = $1; $lastheader = \$cc; } > elsif (/^reply-to:\s*(.*)\s*\n$/i) { $replyto = $1; $lastheader = \$replyto; } > elsif (/^subject:\s*(.*)\n$/i) { $subject = $1; $lastheader = \$subject; } > elsif (/^message-id:\s*(.*)\s*\n$/i) { $messageid = $1; $lastheader = \$messageid; } > # new 'multi-string' line is for adding any string you want to test for in any header - but be careful what you put in here > elsif (/^(.*):\s+(bounce\@|facebook|list-|myspace|twitter)/i) { $logger->debug("Header matching $1: $2 found; exiting"); exit (0); } > elsif (/^x-spam-(flag|status):\s+yes/i) { $logger->debug("x-spam-$1: yes found; exiting"); exit (0); } > # next line is a candidate for removal, since 'facebook' is included in the new 'multi-string' line above > elsif (/^x-facebook-notify:/i) { $logger->debug('Mail from facebook, ignoring'); exit(0); } > elsif (/^precedence:\s+(bulk|junk|list|spam)/i) { $logger->debug("precedence: $1 found; exiting"); exit (0); } > elsif (/^x-loop:\s+postfix\ admin\ virtual\ vacation/i) { $logger->debug("x-loop: postfix admin virtual vacation found; exiting"); exit (0); } > elsif (/^auto-submitted:\s*no/i) { next; } > elsif (/^auto-submitted:/i) { $logger->debug("Auto-Submitted: something found; exiting"); exit (0); } > # next line is a candidate for removal, since 'bounce\@' is included in the new 'multi-string' line above > elsif (/^from:\s+bounce\@/i) { $logger->debug("From-$1: found; exiting"); exit (0); } > # next line is a candidate for removal, since 'list-' is included in the new 'multi-string' line above > elsif (/^list-(.*):/i) { $logger->debug("List-$1: found; exiting"); exit (0); } > elsif (/^(x-assp-spam:\s+yes)/i) { $logger->debug("$1: $3 found; exiting"); exit (0); } > elsif (/^(x-(barracuda-)?spam-status):\s+(yes)/i) { $logger->debug("$1: $3 found; exiting"); exit (0); } > elsif (/^(x-dspam-result):\s+(spam|bl[ao]cklisted)/i) { $logger->debug("$1: $2 found; exiting"); exit (0); } > elsif (/^(x-(anti|avas-)?virus-status):\s+(infected)/i) { $logger->debug("$1: $3 found; exiting"); exit (0); } > elsif (/^(x-(avas-spam|spamtest|crm114|razor|pyzor)-status):\s+(spam)/i) { $logger->debug("$1: $3 found; exiting"); exit (0); } > elsif (/^(x-osbf-lua-score):\s+[0-9\/\.\-\+]+\s+\[([-S])\]/i) { $logger->debug("$1: $2 found; exiting"); exit (0); } > else {$lastheader = "" ; } > } Thanks for any comments/thoughts criticism... |