send-email: enable copying emails to an IMAP folder without actually sending them
`git imap-send` was built on the idea of copying emails to an IMAP folder like drafts, and sending them later using an email client. Currently the only way to do it is by piping output of `git format-patch` to IMAP send. Add another way to do it by using `git send-email` with the `--use-imap-only` or `sendmail.useImapOnly` option. This allows users to use the advanced features of `git send-email` like tweaking Cc: list programmatically, compose the cover letter, etc. and then send the well formatted emails to an IMAP folder using `git imap-send`. While at it, use `` instead of '' for --smtp-encryption ssl in help section of `git send-email`. Signed-off-by: Aditya Garg <gargaditya08@live.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
04133f5bc4
commit
f33b2207da
@@ -89,6 +89,7 @@ sendemail.smtpServerPort::
|
|||||||
sendemail.smtpServerOption::
|
sendemail.smtpServerOption::
|
||||||
sendemail.smtpUser::
|
sendemail.smtpUser::
|
||||||
sendemail.imapSentFolder::
|
sendemail.imapSentFolder::
|
||||||
|
sendemail.useImapOnly::
|
||||||
sendemail.thread::
|
sendemail.thread::
|
||||||
sendemail.transferEncoding::
|
sendemail.transferEncoding::
|
||||||
sendemail.validate::
|
sendemail.validate::
|
||||||
|
|||||||
@@ -311,6 +311,20 @@ must be used for each option.
|
|||||||
This feature requires setting up `git imap-send`. See linkgit:git-imap-send[1]
|
This feature requires setting up `git imap-send`. See linkgit:git-imap-send[1]
|
||||||
for instructions.
|
for instructions.
|
||||||
|
|
||||||
|
--use-imap-only::
|
||||||
|
--no-use-imap-only::
|
||||||
|
If this is set, all emails will only be copied to the IMAP folder specified
|
||||||
|
with `--imap-sent-folder` or `sendemail.imapSentFolder` and will not be sent
|
||||||
|
to the recipients. Useful if you just want to create a draft of the emails
|
||||||
|
and use another email client to send them.
|
||||||
|
If disabled with `--no-use-imap-only`, the emails will be sent like usual.
|
||||||
|
Disabled by default, but the `sendemail.useImapOnly` configuration
|
||||||
|
variable can be used to enable it.
|
||||||
|
|
||||||
|
+
|
||||||
|
This feature requires setting up `git imap-send`. See linkgit:git-imap-send[1]
|
||||||
|
for instructions.
|
||||||
|
|
||||||
--batch-size=<num>::
|
--batch-size=<num>::
|
||||||
Some email servers (e.g. 'smtp.163.com') limit the number of emails to be
|
Some email servers (e.g. 'smtp.163.com') limit the number of emails to be
|
||||||
sent per session (connection) and this will lead to a failure when
|
sent per session (connection) and this will lead to a failure when
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ git send-email --translate-aliases
|
|||||||
--smtp-user <str> * Username for SMTP-AUTH.
|
--smtp-user <str> * Username for SMTP-AUTH.
|
||||||
--smtp-pass <str> * Password for SMTP-AUTH; not necessary.
|
--smtp-pass <str> * Password for SMTP-AUTH; not necessary.
|
||||||
--smtp-encryption <str> * tls or ssl; anything else disables.
|
--smtp-encryption <str> * tls or ssl; anything else disables.
|
||||||
--smtp-ssl * Deprecated. Use '--smtp-encryption ssl'.
|
--smtp-ssl * Deprecated. Use `--smtp-encryption ssl`.
|
||||||
--smtp-ssl-cert-path <str> * Path to ca-certificates (either directory or file).
|
--smtp-ssl-cert-path <str> * Path to ca-certificates (either directory or file).
|
||||||
Pass an empty string to disable certificate
|
Pass an empty string to disable certificate
|
||||||
verification.
|
verification.
|
||||||
@@ -75,6 +75,8 @@ git send-email --translate-aliases
|
|||||||
--smtp-debug <0|1> * Disable, enable Net::SMTP debug.
|
--smtp-debug <0|1> * Disable, enable Net::SMTP debug.
|
||||||
--imap-sent-folder <str> * IMAP folder where a copy of the emails should be sent.
|
--imap-sent-folder <str> * IMAP folder where a copy of the emails should be sent.
|
||||||
Make sure `git imap-send` is set up to use this feature.
|
Make sure `git imap-send` is set up to use this feature.
|
||||||
|
--[no-]use-imap-only * Only copy emails to the IMAP folder specified by
|
||||||
|
`--imap-sent-folder` instead of actually sending them.
|
||||||
|
|
||||||
--batch-size <int> * send max <int> message per connection.
|
--batch-size <int> * send max <int> message per connection.
|
||||||
--relogin-delay <int> * delay <int> seconds between two successive login.
|
--relogin-delay <int> * delay <int> seconds between two successive login.
|
||||||
@@ -296,6 +298,7 @@ my $mailmap = 0;
|
|||||||
my $target_xfer_encoding = 'auto';
|
my $target_xfer_encoding = 'auto';
|
||||||
my $forbid_sendmail_variables = 1;
|
my $forbid_sendmail_variables = 1;
|
||||||
my $outlook_id_fix = 'auto';
|
my $outlook_id_fix = 'auto';
|
||||||
|
my $use_imap_only = 0;
|
||||||
|
|
||||||
my %config_bool_settings = (
|
my %config_bool_settings = (
|
||||||
"thread" => \$thread,
|
"thread" => \$thread,
|
||||||
@@ -312,6 +315,7 @@ my %config_bool_settings = (
|
|||||||
"forbidsendmailvariables" => \$forbid_sendmail_variables,
|
"forbidsendmailvariables" => \$forbid_sendmail_variables,
|
||||||
"mailmap" => \$mailmap,
|
"mailmap" => \$mailmap,
|
||||||
"outlookidfix" => \$outlook_id_fix,
|
"outlookidfix" => \$outlook_id_fix,
|
||||||
|
"useimaponly" => \$use_imap_only,
|
||||||
);
|
);
|
||||||
|
|
||||||
my %config_settings = (
|
my %config_settings = (
|
||||||
@@ -532,6 +536,7 @@ my %options = (
|
|||||||
"smtp-auth=s" => \$smtp_auth,
|
"smtp-auth=s" => \$smtp_auth,
|
||||||
"no-smtp-auth" => sub {$smtp_auth = 'none'},
|
"no-smtp-auth" => sub {$smtp_auth = 'none'},
|
||||||
"imap-sent-folder=s" => \$imap_sent_folder,
|
"imap-sent-folder=s" => \$imap_sent_folder,
|
||||||
|
"use-imap-only!" => \$use_imap_only,
|
||||||
"annotate!" => \$annotate,
|
"annotate!" => \$annotate,
|
||||||
"compose" => \$compose,
|
"compose" => \$compose,
|
||||||
"quiet" => \$quiet,
|
"quiet" => \$quiet,
|
||||||
@@ -1683,6 +1688,8 @@ EOF
|
|||||||
|
|
||||||
if ($dry_run) {
|
if ($dry_run) {
|
||||||
# We don't want to send the email.
|
# We don't want to send the email.
|
||||||
|
} elsif ($use_imap_only) {
|
||||||
|
die __("The destination IMAP folder is not properly defined.") if !defined $imap_sent_folder;
|
||||||
} elsif (defined $sendmail_cmd || file_name_is_absolute($smtp_server)) {
|
} elsif (defined $sendmail_cmd || file_name_is_absolute($smtp_server)) {
|
||||||
my $pid = open my $sm, '|-';
|
my $pid = open my $sm, '|-';
|
||||||
defined $pid or die $!;
|
defined $pid or die $!;
|
||||||
|
|||||||
Reference in New Issue
Block a user