Skip to content

send.c: Allow crypto operations in batch and mailx modes.

Alejandro Colomar requested to merge alx.manpages/mutt:crypto into master
This is useful for signing patches with git-send-email(1).  Here's a
working configuration for that:

In <~/.gitconfig>, add this section:

        [sendemail]
                sendmailcmd = mutt -H - && true

After this patch, all patches sent with git-send-mail(1) will be signed
(and even encrypted, if we have the public keys of all recipients and
have enabled encryption when possible).

This is breaking behavior, so it needs some more justification than just
the above.

This wasn't possible at all with mutt, and is a quite basic operation.
With current mutt(1), you'd need to do trickery with mailboxes to be
able to open patches with mutt in interactive mode and sign/encrypt
them.  One could say don't use git-send-email(1), but then you still
need to open mutt(1) interactively for sending signed mail.  It is
very useful to be able to send a long series of patches or any other
mail without interaction, and have it all signed.

The reason for not enabling this was for allowing running mutt(1) in
cron jobs, or other cases where the keyring can't be unlocked.  This
would still be possible after this patch, although it would need a
change in the configuration.  Users should have a different
configuration for such cron jobs that doesn't ask mutt(1) to use PGP.

Link: https://github.com/neomutt/neomutt/issues/1471

Link: https://github.com/neomutt/neomutt/pull/1476

Link: https://lore.kernel.org/git/xmqqh6ltuqvq.fsf@gitster.g/T/

Co-developed-by: Jenya Sovetkin https://github.com/esovetkin

Cc: neomutt-devel@neomutt.org

I've been using this patched mutt(1) for two weeks or so already for sending patches to mailing lists, and it works fine for me. I sent this patch to the mailing list, but I haven't been accepted yet into the list, so it didn't arrive there.

Edited by Alejandro Colomar

Merge request reports