@ -143,7 +143,7 @@ sub unique_email_list(@);
sub cleanup_compose_files();
sub cleanup_compose_files();
# Variables we fill in automatically, or via prompting:
# Variables we fill in automatically, or via prompting:
my (@to,$no_to,@cc,$no_cc,@initial_cc,@bcclist,$no_bcc,@xh,
my (@to,$no_to,@initial_to,@cc,$no_cc,@initial_cc,@bcclist,$no_bcc,@xh,
$initial_reply_to,$initial_subject,@files,
$initial_reply_to,$initial_subject,@files,
$author,$sender,$smtp_authpass,$annotate,$compose,$time);
$author,$sender,$smtp_authpass,$annotate,$compose,$time);
@ -222,7 +222,7 @@ my %config_settings = (
"smtpuser" => \$smtp_authuser,
"smtpuser" => \$smtp_authuser,
"smtppass" => \$smtp_authpass,
"smtppass" => \$smtp_authpass,
"smtpdomain" => \$smtp_domain,
"smtpdomain" => \$smtp_domain,
"to" => \@to,
"to" => \@initial_to,
"tocmd" => \$to_cmd,
"tocmd" => \$to_cmd,
"cc" => \@initial_cc,
"cc" => \@initial_cc,
"cccmd" => \$cc_cmd,
"cccmd" => \$cc_cmd,
@ -281,7 +281,7 @@ $SIG{INT} = \&signal_handler;
my $rc = GetOptions("sender|from=s" => \$sender,
my $rc = GetOptions("sender|from=s" => \$sender,
"in-reply-to=s" => \$initial_reply_to,
"in-reply-to=s" => \$initial_reply_to,
"subject=s" => \$initial_subject,
"subject=s" => \$initial_subject,
"to=s" => \@to,
"to=s" => \@initial_to,
"to-cmd=s" => \$to_cmd,
"to-cmd=s" => \$to_cmd,
"no-to" => \$no_to,
"no-to" => \$no_to,
"cc=s" => \@initial_cc,
"cc=s" => \@initial_cc,
@ -422,7 +422,7 @@ my ($repoauthor, $repocommitter);
# Verify the user input
# Verify the user input
foreach my $entry (@to) {
foreach my $entry (@initial_to) {
die "Comma in --to entry: $entry'\n" unless $entry !~ m/,/;
die "Comma in --to entry: $entry'\n" unless $entry !~ m/,/;
}
}
@ -734,9 +734,9 @@ if (!defined $sender) {
$prompting++;
$prompting++;
}
}
if (!@to && !defined $to_cmd) {
if (!@initial_to && !defined $to_cmd) {
my $to = ask("Who should the emails be sent to? ");
my $to = ask("Who should the emails be sent to? ");
push @to, parse_address_line($to) if defined $to; # sanitized/validated later
push @initial_to, parse_address_line($to) if defined $to; # sanitized/validated later
$prompting++;
$prompting++;
}
}
@ -754,8 +754,8 @@ sub expand_one_alias {
return $aliases{$alias} ? expand_aliases(@{$aliases{$alias}}) : $alias;
return $aliases{$alias} ? expand_aliases(@{$aliases{$alias}}) : $alias;
}
}
@to = expand_aliases(@to);
@initial_to = expand_aliases(@initial_to);
@to = (map { sanitize_address($_) } @to);
@initial_to = (map { sanitize_address($_) } @initial_to);
@initial_cc = expand_aliases(@initial_cc);
@initial_cc = expand_aliases(@initial_cc);
@bcclist = expand_aliases(@bcclist);
@bcclist = expand_aliases(@bcclist);
@ -1161,6 +1161,7 @@ foreach my $t (@files) {
my $author_encoding;
my $author_encoding;
my $has_content_type;
my $has_content_type;
my $body_encoding;
my $body_encoding;
@to = ();
@cc = ();
@cc = ();
@xh = ();
@xh = ();
my $input_format = undef;
my $input_format = undef;
@ -1201,6 +1202,13 @@ foreach my $t (@files) {
$1, $_) unless $quiet;
$1, $_) unless $quiet;
push @cc, $1;
push @cc, $1;
}
}
elsif (/^To:\s+(.*)$/) {
foreach my $addr (parse_address_line($1)) {
printf("(mbox) Adding to: %s from line '%s'\n",
$addr, $_) unless $quiet;
push @to, sanitize_address($addr);
}
}
elsif (/^Cc:\s+(.*)$/) {
elsif (/^Cc:\s+(.*)$/) {
foreach my $addr (parse_address_line($1)) {
foreach my $addr (parse_address_line($1)) {
if (unquote_rfc2047($addr) eq $sender) {
if (unquote_rfc2047($addr) eq $sender) {
@ -1307,6 +1315,7 @@ foreach my $t (@files) {
($confirm =~ /^(?:auto|compose)$/ && $compose && $message_num == 1));
($confirm =~ /^(?:auto|compose)$/ && $compose && $message_num == 1));
$needs_confirm = "inform" if ($needs_confirm && $confirm_unconfigured && @cc);
$needs_confirm = "inform" if ($needs_confirm && $confirm_unconfigured && @cc);
@to = (@initial_to, @to);
@cc = (@initial_cc, @cc);
@cc = (@initial_cc, @cc);
my $message_was_sent = send_message();
my $message_was_sent = send_message();