73
--no-smtp-auth * Disable SMTP authentication. Shorthand for
74
`--smtp-auth=none`
75
--smtp-debug <0|1> * Disable, enable Net::SMTP debug.
76
+ --imap-sent-folder <str> * IMAP folder where a copy of the emails should be sent.
77
+ Make sure `git imap-send` is set up to use this feature.
78
79
--batch-size <int> * send max <int> message per connection.
80
--relogin-delay <int> * delay <int> seconds between two successive login.
202
203
# Variables we fill in automatically, or via prompting:
204
my (@to,@cc,@xh,$envelope_sender,
203
- $initial_in_reply_to,$reply_to,$initial_subject,@files,
205
+ $initial_in_reply_to,$reply_to,$initial_subject,@files,@imap_copy,
206
$author,$sender,$smtp_authpass,$annotate,$compose,$time);
207
# Things we either get from config, *or* are overridden on the
208
# command-line.
279
my ($smtp_authuser, $smtp_encryption, $smtp_ssl_cert_path);
280
my ($batch_size, $relogin_delay);
281
my ($identity, $aliasfiletype, @alias_files, $smtp_domain, $smtp_auth);
282
+my ($imap_sent_folder);
283
my ($confirm);
284
my (@suppress_cc);
285
my ($auto_8bit_encoding);
325
"smtpauth" => \$smtp_auth,
326
"smtpbatchsize" => \$batch_size,
327
"smtprelogindelay" => \$relogin_delay,
328
+ "imapsentfolder" => \$imap_sent_folder,
329
"to" => \@config_to,
330
"tocmd" => \$to_cmd,
331
"cc" => \@config_cc,
531
"smtp-domain:s" => \$smtp_domain,
532
"smtp-auth=s" => \$smtp_auth,
533
"no-smtp-auth" => sub {$smtp_auth = 'none'},
534
+ "imap-sent-folder=s" => \$imap_sent_folder,
535
"annotate!" => \$annotate,
536
"compose" => \$compose,
537
"quiet" => \$quiet,
1834
print "\n";
1835
}
1836
1837
+ if ($imap_sent_folder && !$dry_run) {
1838
+ my $imap_header = $header;
1839
+ if (@initial_bcc) {
1840
+ # Bcc is not a part of $header, so we add it here.
1841
+ # This is only for the IMAP copy, not for the actual email
1842
+ # sent to the recipients.
1843
+ $imap_header .= "Bcc: " . join(", ", @initial_bcc) . "\n";
1844
+ }
1845
+ push @imap_copy, "From git-send-email\n$imap_header\n$message";
1846
+ }
1847
+
1848
return 1;
1849
}
1850
2239
2240
$smtp->quit if $smtp;
2241
2242
+if ($imap_sent_folder && @imap_copy && !$dry_run) {
2243
+ my $imap_input = join("\n", @imap_copy);
2244
+ eval {
2245
+ print "\nStarting git imap-send...\n";
2246
+ my ($fh, $ctx) = Git::command_input_pipe(['imap-send', '-f', $imap_sent_folder]);
2247
+ print $fh $imap_input;
2248
+ Git::command_close_pipe($fh, $ctx);
2249
+ 1;
2250
+ } or do {
2251
+ warn "Warning: failed to send messages to IMAP folder $imap_sent_folder: $@";
2252
+ };
2253
+}
2254
+
2255
sub apply_transfer_encoding {
2256
my $message = shift;
2257
my $from = shift;