Supporter full name in To: line.

This requires Unicode.
This commit is contained in:
Bradley M. Kuhn 2016-01-18 10:42:42 -08:00
parent 0aad420434
commit f96f9242c7

View file

@ -19,6 +19,9 @@
use strict; use strict;
use warnings; use warnings;
use Encode;
use utf8;
if (@ARGV != 3) { if (@ARGV != 3) {
print "usage: $0 <LIST_OF_ADDRESSES_FILE> <MESSAGE_FILE> <FRM_ADDR>\n"; print "usage: $0 <LIST_OF_ADDRESSES_FILE> <MESSAGE_FILE> <FRM_ADDR>\n";
exit 1; exit 1;
@ -46,14 +49,16 @@ my @message;
close MESSAGE; close MESSAGE;
foreach my $fullEmailLine (@sendTo) { foreach my $fullEmailLine (@sendTo) {
$fullEmailLine =~ s/\s*#.*$//; $fullEmailLine =~ s/\s*$//; $fullEmailLine =~ s/^\s*//;
$fullEmailLine = Encode::encode("MIME-Header", $fullEmailLine);
#
my $emailTo = $fullEmailLine; my $emailTo = $fullEmailLine;
$emailTo =~ s/^[^<]+\<\s*([^\>]+)\s*\>\s*$/$1/; $emailTo =~ s/^[^<]+\<\s*([^\>]+)\s*\>\s*$/$1/;
open(SENDMAIL, "|/usr/lib/sendmail -f \"$FROM_ADDRESS\" -oi -oem -- $emailTo") or open(SENDMAIL, "|/usr/lib/sendmail -f \"$FROM_ADDRESS\" -oi -oem -- $emailTo $FROM_ADDRESS") or
die "unable to run sendmail: $!"; die "unable to run sendmail: $!";
print SENDMAIL "To: $emailTo\n"; # X-Precedence: bulk\n"; print SENDMAIL "To: $fullEmailLine\n"; # X-Precedence: bulk\n";
print SENDMAIL @message; print SENDMAIL @message;
close SENDMAIL; close SENDMAIL;