Index: mail-out.pl =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/og2list/mail-out.pl,v retrieving revision 1.36 diff -u -p -r1.36 mail-out.pl --- mail-out.pl 6 Sep 2006 00:17:10 -0000 1.36 +++ mail-out.pl 20 Oct 2006 00:23:04 -0000 @@ -195,7 +195,9 @@ sub send_bsmtp($$$$) { print BSMTP $content; print BSMTP "\n.\n"; } - close(BSMTP) && map {$set_sentflag_handle->execute($mid, $_)} @$recipients; + foreach my $mid (@$mids) { + close(BSMTP) && map {$set_sentflag_handle->execute($mid, $_)} @$recipients; + } } sub send_sendmail($$$$) { @@ -209,7 +211,9 @@ sub send_sendmail($$$$) { open(SENDMAIL, '|-') || exec($sendmail_binary, @sendmail_args, $verp_addr, $rcpt_addr); print SENDMAIL $content; - close(SENDMAIL) && $set_sentflag_handle->execute($mid, $rcpt_addr); + foreach my $mid (@$mids) { + close(SENDMAIL) && $set_sentflag_handle->execute($mid, $rcpt_addr); + } } } @@ -231,7 +235,9 @@ sub send_smtp($$$$) { $smtp->to($rcpt_addr) or do {$smtp->reset(); next}; $smtp->data($content) or do {$smtp->reset(); next}; - $set_sentflag_handle->execute($mid, $rcpt_addr); + foreach my $mid (@$mids) { + $set_sentflag_handle->execute($mid, $rcpt_addr); + } } $smtp->quit(); } @@ -242,7 +248,9 @@ sub send_blackhole($$$$) { my $sender = shift; my $recipients = shift; - map {$set_sentflag_handle->execute($mid, $_)} @$recipients; + foreach my $mid (@$mids) { + map {$set_sentflag_handle->execute($mid, $_)} @$recipients; + } return; } @@ -252,7 +260,7 @@ getopts('d', \%opts); $do_digest = $opts{'d'}; # Make database connection -$dsn = "DBI:$dbtype:$dbase:$dbhost"; +$dsn = "DBI:$dbtype:og2list:$dbhost"; $dbh = DBI->connect($dsn, $dbuser, $dbauth) or die; # Work around charset encoding confusion. @@ -333,13 +341,13 @@ if ($do_digest) { while (my @recipients = splice @{$digest_msgs{$_}{recipients}},0,$batch_size) { # print "- ".join(', ', @recipients)."\n"; foreach ($send_method) { - /^sendmail$/i && do { send_sendmail([$mid], $content, $sender, + /^sendmail$/i && do { send_sendmail([@mids], $content, $sender, [@recipients]); last; }; - /^bsmtp$/i && do { send_bsmtp([$mid], $content, $sender, + /^bsmtp$/i && do { send_bsmtp([@mids], $content, $sender, [@recipients]); last; }; - /^smtp$/i && do { send_smtp([$mid], $content, $sender, + /^smtp$/i && do { send_smtp([@mids], $content, $sender, [@recipients]); last; }; - /^blackhole$/i && do { send_blackhole([$mid], $content, $sender, + /^blackhole$/i && do { send_blackhole([@mids], $content, $sender, [@recipients]); last; }; die("Value of \$send_method not recognized: $send_method"); }