git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@92 a1433add-5e2c-0410-b055-b7f2511e0802
postfixadmin-2.3
David Goodwin 17 years ago
parent 54650c8b1f
commit eb6bca9047

@ -124,14 +124,17 @@ if ($db_type eq "mysql") {
my $loopcount=0; my $loopcount=0;
sub do_debug { sub do_debug {
my ($in1, $in2, $in3, $in4, $in5, $in6) = @_;
if ( $debugfile ) { if ( $debugfile ) {
my $date; my $date;
open (DEBUG, ">> $debugfile") or die ("Unable to open debug file"); open (DEBUG, ">> $debugfile") or die ("Unable to open debug file");
binmode (DEBUG, ':utf8'); binmode (DEBUG, ':utf8');
chop ($date = `date "+%Y/%m/%d %H:%M:%S"`); chop ($date = `date "+%Y/%m/%d %H:%M:%S"`);
print DEBUG "====== $date ======\n"; print DEBUG "====== $date ======\n";
printf DEBUG "%s | %s | %s | %s | %s | %s\n", $in1, $in2, $in3, $in4, $in5, $in6; my $i;
for ($i=0;$i<$#_;$i++) {
print DEBUG $_[$i], ' | ';
}
print DEBUG $_[($#_)], "\n";
close (DEBUG); close (DEBUG);
} }
} }
@ -202,7 +205,7 @@ sub do_mail {
'Message' => encode_base64($body) 'Message' => encode_base64($body)
); );
sendmail(%mail) or do_log($Mail::Sendmail::error); sendmail(%mail) or do_log($Mail::Sendmail::error);
do_debug('Mail::Sendmail said :' . $Mail::Sendmail::log,'','','','',''); do_debug('Mail::Sendmail said :' . $Mail::Sendmail::log);
} }
sub panic { sub panic {
@ -294,7 +297,7 @@ sub send_vacation_email {
if ($rv == 1) { if ($rv == 1) {
my @row = $stm->fetchrow_array; my @row = $stm->fetchrow_array;
if (already_notified($email, $orig_from)) { return; } if (already_notified($email, $orig_from)) { return; }
do_debug ("[SEND RESPONSE] for $orig_messageid:\n", "FROM: $email (orig_to: $orig_to)\n", "TO: $orig_from\n", "VACATION SUBJECT: $row[0]\n", "VACATION BODY: $row[1]\n", ''); do_debug ("[SEND RESPONSE] for $orig_messageid:\n", "FROM: $email (orig_to: $orig_to)\n", "TO: $orig_from\n", "VACATION SUBJECT: $row[0]\n", "VACATION BODY: $row[1]\n");
# do_mail(from, to, subject, body); # do_mail(from, to, subject, body);
do_mail ($email, $orig_from, $row[0], $row[1]); do_mail ($email, $orig_from, $row[0], $row[1]);
@ -326,7 +329,7 @@ if (!$from || !$to || !$messageid) { exit (0); }
$from = lc ($from); $from = lc ($from);
if (!Email::Valid->address($from,-mxcheck => 1)) { do_debug("", "", "", "", "", "Invalid from email address: $from; exiting."); exit(0); } if (!Email::Valid->address($from,-mxcheck => 1)) { do_debug("Invalid from email address: $from; exiting."); exit(0); }
# Check if it's an obvious sender, exit # Check if it's an obvious sender, exit
if ($from =~ /([\w\-.%]+\@[\w.-]+)/) { $from = $1; } if ($from =~ /([\w\-.%]+\@[\w.-]+)/) { $from = $1; }
@ -344,7 +347,7 @@ my @search_array;
for (@strip_to_array) { for (@strip_to_array) {
if ($_ =~ /([\w\-.%]+\@[\w.-]+)/) { if ($_ =~ /([\w\-.%]+\@[\w.-]+)/) {
push (@search_array, $1); push (@search_array, $1);
do_debug ("[STRIP RECIPIENTS]: ", $messageid, $1, "-", "-", "-"); do_debug ("[STRIP RECIPIENTS]: ", $messageid, $1);
} }
} }
@ -354,7 +357,7 @@ for (@search_array) {
my $addr = $1; my $addr = $1;
my ($rv, $email) = find_real_address ($addr); my ($rv, $email) = find_real_address ($addr);
if ($rv == 1) { if ($rv == 1) {
do_debug ("[FOUND VACATION]: ", $messageid, $from, $to, $email, ''); do_debug ("[FOUND VACATION]: ", $messageid, $from, $to, $email);
send_vacation_email( $email, $from, $to, $messageid); send_vacation_email( $email, $from, $to, $messageid);
} }
} }

Loading…
Cancel
Save