SF.net SVN: postfixadmin:[457] trunk/VIRTUAL_VACATION/vacation.pl
Brought to you by:
christian_boltz,
gingerdog
|
From: <Gin...@us...> - 2008-09-03 08:44:31
|
Revision: 457
http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=457&view=rev
Author: GingerDog
Date: 2008-09-03 08:44:36 +0000 (Wed, 03 Sep 2008)
Log Message:
-----------
1- fix smtp_recipient (i.e un-vacationise-it), 2- remove the needless \s* stuff - these will get removed by the strip_address() routine anyway
Modified Paths:
--------------
trunk/VIRTUAL_VACATION/vacation.pl
Modified: trunk/VIRTUAL_VACATION/vacation.pl
===================================================================
--- trunk/VIRTUAL_VACATION/vacation.pl 2008-09-03 08:32:25 UTC (rev 456)
+++ trunk/VIRTUAL_VACATION/vacation.pl 2008-09-03 08:44:36 UTC (rev 457)
@@ -103,6 +103,8 @@
my $db_password = 'gingerdog';
my $db_name = 'postfix';
+my $vacation_domain = 'autoreply.example.org';
+
# smtp server used to send vacation e-mails
my $smtp_server = 'localhost';
@@ -452,24 +454,34 @@
while (<STDIN>) {
last if (/^$/);
if (/^\s+(.*)/ and $lastheader) { $$lastheader .= " $1"; next; }
- elsif (/^from:\s*(.*)\b\s*\n$/i) { $from = $1; $lastheader = \$from; }
- elsif (/^to:\s*(.*)\s*\n$/i) { $to = $1; $lastheader = \$to; }
- elsif (/^cc:\s*(.*)\s*\n$/i) { $cc = $1; $lastheader = \$cc; }
+ 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*(.*)\s*\n$/i) { $subject = $1; $lastheader = \$subject; }
+ elsif (/^subject:\s*(.*)\n$/i) { $subject = $1; $lastheader = \$subject; }
elsif (/^message-id:\s*(.*)\s*\n$/i) { $messageid = $1; $lastheader = \$messageid; }
elsif (/^x-spam-(flag|status):\s+yes/i) { $logger->debug("x-spam-$1: yes found; exiting"); exit (0); }
elsif (/^x-facebook-notify:/i) { $logger->debug('Mail from facebook, ignoring'); exit(0); }
elsif (/^precedence:\s+(bulk|list|junk)/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\b*/i) { next; }
+ elsif (/^Auto-Submitted:\s*no/i) { next; }
elsif (/^Auto-Submitted:/i) { $logger->debug("Auto-Submitted: something found; exiting"); exit (0); }
elsif (/^List-(Id|Post):/i) { $logger->debug("List-$1: found; exiting"); exit (0); }
else {$lastheader = "" ; }
}
+if($smtp_recipient =~ /\@$vacation_domain/) {
+ # the regexp used here could probably be improved somewhat, for now hope that people won't use # as a valid mailbox character.
+ my $tmp = $smtp_recipient;
+ $tmp =~ s/\@$vacation_domain//;
+ $tmp =~ s/#/\@/;
+ $logger->debug("Converted autoreply mailbox back to normal style - from $smtp_recipient to $tmp");
+ $smtp_recipient = $tmp;
+ undef $tmp;
+}
+
# If either From: or To: are not set, exit
if(!$from || !$to || !$messageid || !$smtp_sender || !$smtp_recipient) {
$logger->info("One of from=$from, to=$to, messageid=$messageid, smtp sender=$smtp_sender, smtp recipient=$smtp_recipient empty");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|