mirror of
https://github.com/git/git.git
synced 2026-01-10 10:13:33 +00:00
send-email: add ability to send a copy of sent emails to an IMAP folder
Some email providers like Apple iCloud Mail do not support sending a copy of sent emails to the "Sent" folder if SMTP server is used. As a workaround, various email clients like Thunderbird which rely on SMTP, use IMAP to send a copy of sent emails to the "Sent" folder. Something similar can be done if sending emails via `git send-email`, by using the `git imap-send` command to send a copy of the sent email to an IMAP folder specified by the user. Add this functionality to `git send-email` by introducing a new configuration variable `sendemail.imapfolder` and command line option `--imap-folder` which specifies the IMAP folder to send a copy of the sent emails to. If specified, a copy of the sent emails will be sent by piping the emails to `git imap-send` command, after all emails are sent via SMTP and the SMTP server has been closed. 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
3f2a94875d
commit
04133f5bc4
26
imap-send.c
26
imap-send.c
@@ -1441,14 +1441,24 @@ static int count_messages(struct strbuf *all_msgs)
|
||||
|
||||
while (1) {
|
||||
if (starts_with(p, "From ")) {
|
||||
p = strstr(p+5, "\nFrom: ");
|
||||
if (!p) break;
|
||||
p = strstr(p+7, "\nDate: ");
|
||||
if (!p) break;
|
||||
p = strstr(p+7, "\nSubject: ");
|
||||
if (!p) break;
|
||||
p += 10;
|
||||
count++;
|
||||
if (starts_with(p, "From git-send-email")) {
|
||||
p = strstr(p+5, "\nFrom: ");
|
||||
if (!p) break;
|
||||
p += 7;
|
||||
p = strstr(p, "\nTo: ");
|
||||
if (!p) break;
|
||||
p += 5;
|
||||
count++;
|
||||
} else {
|
||||
p = strstr(p+5, "\nFrom: ");
|
||||
if (!p) break;
|
||||
p = strstr(p+7, "\nDate: ");
|
||||
if (!p) break;
|
||||
p = strstr(p+7, "\nSubject: ");
|
||||
if (!p) break;
|
||||
p += 10;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
p = strstr(p+5, "\nFrom ");
|
||||
if (!p)
|
||||
|
||||
Reference in New Issue
Block a user