Re: BUG: emacs: fcc duplicates messages with variant bodies due to mml security

Subject:Re: BUG: emacs: fcc duplicates messages with variant bodies due to mml security

Date:Wed, 19 Jan 2022 09:56:51 -0400

To:Daniel Kahn Gillmor ,Notmuch Mail


From:David Bremner

Daniel Kahn Gillmor <> writes:

> I'm currently working around this by setting notmuch-fcc-dirs to nil,
> and setting message-send-mail-hook to (dkg-notmuch-fcc), which is defined
> as:
>     (defun dkg-notmuch-fcc ()
>       (shell-command-on-region (point-min) (point-max) "notmuch insert"))
> this takes advantage of message-send-mail-hook's late-send.  as the
> documentation for that var says:
>     This hook is run very late -- just before the message is sent as
>     mail.
> But this isn't something normal users should need to do manually.
> Any emacs gurus want to propose a way to improve the situation?  i'm at
> a bit of a loss.

Not an "emacs guru". However... 

Currently our fcc processing is run (in a slightly weird way by
rebinding message-do-fcc) just before message-sent-hook. This has the
potentially important semantics that it only runs for messages that are
successfully sent.

There is a variable message-encoded-mail-cache, which holds the raw sent
message. We should probably use this instead of doing our own
re-encoding (mml-generate-mime does the actual mime stuff, and is called
from message-encode-message-body. Larsi added this variable to gnus
after we copied and modified message-do-fcc. The change _looks_
relatively simple, guarding the call to message-encode-message-body as

	;; Avoid re-doing things like GPG-encoding secret parts.
	(if (not encoded-cache)
	  (insert encoded-cache))

notmuch mailing list --
To unsubscribe send an email to