Subject: Re: [PATCH v2] send-email: add ability to send a copy of sent emails to an IMAP folder

From: Junio C Hamano <[email-masked]>
Date: Mon, 21 Jul 2025 22:09:01 -0700

Aditya Garg <[email-masked]> writes:

> Or maybe you mean, ONLY send via imap and don't use SMTP? Like
> this users can use their email clients to send emails?

Exactly.  You sold this feature as "have send-email send the
message, and keep an extra copy you sent in your Sent imap folder".

I pointed out that "have send-email do everything it would normally
do before it talks to MSA or talk SMTP to send messages out, and
instead drive imap-send to store these messages in a folder like
imap-send users have used the program so far---as the user will send
the messages out of their draft folder as was traditionally done by
any imap-send users, send-email will *not* send anything out itself"
as a possible different way send-email may want to use imap-send.

These are two very different use cases.  We could organize things
this way:

 A1. When imap-folder is specified, that IMAP folder will get an extra
     copy, in addition to what send-email sends out;

 A2. When yet another new option, --send-email-no-send, is
     specified, send-email would not send any messages out.  Even
     when this option is in effect, if --imap-folder is specified,
     that IMAP folder will get an extra copy, in addition to what
     send-email would send out (which is nothing).

Or alternatively, we can have two very different operation modes
that both involve imap-send:

 B1. When --imap-sent-folder is specified, that IMAP folder will get
     an extra copy, in addition to what send-email sent out via its
     usual route (like by invoking MSA or talking SMTP)

 B2. When --imap-outgo-folder is specified, that IMAP folder will
     get the outgo copy, later to be sent by the user (just like a
     user of imap-send would usually use), and send-email would not
     send out anything by its usual route.

I thought the latter would be easier to explain to end-users, which
is why "sent" or "fcc" or something like that should be in the name
of the option when operating in the mode the patch implements.

This brings up a yet another possibility.  Invoking imap-send can be
a new third way send-email uses to send out the messages, in addition
to existing (1) invoking a local "/usr/lib/sendmail" program, or (2)
talking SMTP to smarthost.  That would be very easy to explain the
operating mode B2 to users of send-email or users of imap-send, but
it would be a bit awkward to find where B1 conceptually fits.