@@ -143,7 +143,7 @@ sub format_2822_time {
143
143
sub cleanup_compose_files ();
144
144
145
145
# Variables we fill in automatically, or via prompting:
146
- my (@to ,$no_to ,@cc ,$no_cc ,@initial_cc ,@bcclist ,$no_bcc ,@xh ,
146
+ my (@to ,$no_to ,@initial_to , @ cc ,$no_cc ,@initial_cc ,@bcclist ,$no_bcc ,@xh ,
147
147
$initial_reply_to ,$initial_subject ,@files ,
148
148
$author ,$sender ,$smtp_authpass ,$annotate ,$compose ,$time );
149
149
@@ -222,7 +222,7 @@ sub do_edit {
222
222
" smtpuser" => \$smtp_authuser ,
223
223
" smtppass" => \$smtp_authpass ,
224
224
" smtpdomain" => \$smtp_domain ,
225
- " to" => \@to ,
225
+ " to" => \@initial_to ,
226
226
" tocmd" => \$to_cmd ,
227
227
" cc" => \@initial_cc ,
228
228
" cccmd" => \$cc_cmd ,
@@ -281,7 +281,7 @@ sub signal_handler {
281
281
my $rc = GetOptions(" sender|from=s" => \$sender ,
282
282
" in-reply-to=s" => \$initial_reply_to ,
283
283
" subject=s" => \$initial_subject ,
284
- " to=s" => \@to ,
284
+ " to=s" => \@initial_to ,
285
285
" to-cmd=s" => \$to_cmd ,
286
286
" no-to" => \$no_to ,
287
287
" cc=s" => \@initial_cc ,
@@ -422,7 +422,7 @@ sub read_config {
422
422
423
423
# Verify the user input
424
424
425
- foreach my $entry (@to ) {
425
+ foreach my $entry (@initial_to ) {
426
426
die " Comma in --to entry: $entry '\n " unless $entry !~ m / ,/ ;
427
427
}
428
428
734
734
$prompting ++;
735
735
}
736
736
737
- if (!@to && !defined $to_cmd ) {
737
+ if (!@initial_to && !defined $to_cmd ) {
738
738
my $to = ask(" Who should the emails be sent to? " );
739
- push @to , parse_address_line($to ) if defined $to ; # sanitized/validated later
739
+ push @initial_to , parse_address_line($to ) if defined $to ; # sanitized/validated later
740
740
$prompting ++;
741
741
}
742
742
@@ -754,8 +754,8 @@ sub expand_one_alias {
754
754
return $aliases {$alias } ? expand_aliases(@{$aliases {$alias }}) : $alias ;
755
755
}
756
756
757
- @to = expand_aliases(@to );
758
- @to = (map { sanitize_address($_ ) } @to );
757
+ @initial_to = expand_aliases(@initial_to );
758
+ @initial_to = (map { sanitize_address($_ ) } @initial_to );
759
759
@initial_cc = expand_aliases(@initial_cc );
760
760
@bcclist = expand_aliases(@bcclist );
761
761
@@ -1161,6 +1161,7 @@ sub send_message {
1161
1161
my $author_encoding ;
1162
1162
my $has_content_type ;
1163
1163
my $body_encoding ;
1164
+ @to = ();
1164
1165
@cc = ();
1165
1166
@xh = ();
1166
1167
my $input_format = undef ;
@@ -1201,6 +1202,13 @@ sub send_message {
1201
1202
$1 , $_ ) unless $quiet ;
1202
1203
push @cc , $1 ;
1203
1204
}
1205
+ elsif (/ ^To:\s +(.*)$ / ) {
1206
+ foreach my $addr (parse_address_line($1 )) {
1207
+ printf (" (mbox) Adding to: %s from line '%s '\n " ,
1208
+ $addr , $_ ) unless $quiet ;
1209
+ push @to , sanitize_address($addr );
1210
+ }
1211
+ }
1204
1212
elsif (/ ^Cc:\s +(.*)$ / ) {
1205
1213
foreach my $addr (parse_address_line($1 )) {
1206
1214
if (unquote_rfc2047($addr ) eq $sender ) {
@@ -1307,6 +1315,7 @@ sub send_message {
1307
1315
($confirm =~ / ^(?:auto|compose)$ / && $compose && $message_num == 1));
1308
1316
$needs_confirm = " inform" if ($needs_confirm && $confirm_unconfigured && @cc );
1309
1317
1318
+ @to = (@initial_to , @to );
1310
1319
@cc = (@initial_cc , @cc );
1311
1320
1312
1321
my $message_was_sent = send_message();
0 commit comments