@@ -49,6 +49,9 @@ sub usage {
4949 --cc Specify an initial "Cc:" list for the entire series
5050 of emails.
5151
52+ --cc-cmd Specify a command to execute per file which adds
53+ per file specific cc address entries
54+
5255 --bcc Specify a list of email addresses that should be Bcc:
5356 on all the emails.
5457
@@ -160,13 +163,14 @@ sub format_2822_time {
160163my ($quiet , $dry_run ) = (0, 0);
161164
162165# Variables with corresponding config settings
163- my ($thread , $chain_reply_to , $suppress_from , $signed_off_cc );
166+ my ($thread , $chain_reply_to , $suppress_from , $signed_off_cc , $cc_cmd );
164167
165168my %config_settings = (
166169 " thread" => [\$thread , 1],
167170 " chainreplyto" => [\$chain_reply_to , 1],
168171 " suppressfrom" => [\$suppress_from , 0],
169172 " signedoffcc" => [\$signed_off_cc , 1],
173+ " cccmd" => [\$cc_cmd , " " ],
170174);
171175
172176foreach my $setting (keys %config_settings ) {
@@ -192,6 +196,7 @@ sub format_2822_time {
192196 " smtp-server=s" => \$smtp_server ,
193197 " compose" => \$compose ,
194198 " quiet" => \$quiet ,
199+ " cc-cmd=s" => \$cc_cmd ,
195200 " suppress-from!" => \$suppress_from ,
196201 " signed-off-cc|signed-off-by-cc!" => \$signed_off_cc ,
197202 " dry-run" => \$dry_run ,
@@ -655,11 +660,26 @@ sub send_message
655660 }
656661 }
657662 close F;
663+
664+ if ($cc_cmd ne " " ) {
665+ open (F, " $cc_cmd $t |" )
666+ or die " (cc-cmd) Could not execute '$cc_cmd '" ;
667+ while (<F>) {
668+ my $c = $_ ;
669+ $c =~ s / ^\s *// g ;
670+ $c =~ s /\n $// g ;
671+ push @cc , $c ;
672+ printf (" (cc-cmd) Adding cc: %s from: '%s '\n " ,
673+ $c , $cc_cmd ) unless $quiet ;
674+ }
675+ close F
676+ or die " (cc-cmd) failed to close pipe to '$cc_cmd '" ;
677+ }
678+
658679 if (defined $author ) {
659680 $message = " From: $author \n\n $message " ;
660681 }
661682
662-
663683 send_message();
664684
665685 # set up for the next message
0 commit comments