Browse Source

Merge pull request #930 from edneville/get_accountname

vacation.pl 

 * get_accountname should use $from_mailbox
 * Additional PBP stern fixes
pull/931/head
David Goodwin 2 months ago
committed by GitHub
parent
commit
a44664a427
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 5
      VIRTUAL_VACATION/Contributions.txt
  2. 10
      VIRTUAL_VACATION/vacation.pl

5
VIRTUAL_VACATION/Contributions.txt

@ -103,3 +103,8 @@ Additional authors:
Fix handling of the default $smtp_client setthing of 'localhost'
if we aren't connecting to the SMTP server on localhost.
2023-08-18 Ed Neville <ed@s5h.net>
Optional /usr/sbin/sendmail, some setups benefit from piped delivery
PBP stern fixes
Minor parameter bugfix in get_accountname

10
VIRTUAL_VACATION/vacation.pl

@ -33,6 +33,9 @@ use File::Basename;
use Net::DNS;
use Time::Piece;
use strict;
use warnings;
# ========== begin configuration ==========
# IMPORTANT: If you put passwords into this script, then remember
@ -377,7 +380,7 @@ sub get_accountname {
my $query = qq{SELECT name FROM mailbox WHERE username=? };
my $stm = $dbh->prepare($query) or panic_prepare($query);
$stm->execute($to) or panic_execute($query,"username='$from_mailbox'");
$stm->execute($from_mailbox) or panic_execute($query,"username='$from_mailbox'");
my @row = $stm->fetchrow_array;
my $rv = $stm->rows;
@ -566,7 +569,7 @@ sub send_vacation_email {
my $resolver = Net::DNS::Resolver->new;
my @mx = mx($resolver, $email_domain_part);
if (@mx) {
$smtp_server = @mx[0]->exchange;
$smtp_server = $mx[0]->exchange;
$logger->debug("Found MX record <$smtp_server> for user <$email>!");
} else {
$logger->error("Unable to find MX record for user <$email>, error message: ".$resolver->errorstring);
@ -658,6 +661,7 @@ sub send_vacation_email {
}
}
}
return;
}
# Convert a (list of) email address(es) from RFC 822 style addressing to
@ -738,7 +742,7 @@ $replyto = '';
$logger->debug("Script argument SMTP recipient is : '$smtp_recipient' and smtp_sender : '$smtp_sender'");
while (<STDIN>) {
while (<>) {
last if (/^$/);
if (/^\s+(.*)/ and $lastheader) { $$lastheader .= " $1"; next; }
elsif (/^from:\s*(.*)\n$/i) { $from = $1; $lastheader = \$from; }

Loading…
Cancel
Save