Re: What's the best way to auto-sign some emails but not all?

Trevor Arjeski <[email protected]> Sat, 30 Nov 2024 21:29:55 +0300
Newsgroups gmane.emacs.gnus.general
Message-ID <[email protected]>
Bjørn Mork <[email protected]> writes:

> Is there a nice way to always sign emails based on e.g. the current From
> address?  I don't want to sign everything, but I would like to sign all
> emails I send from one specific address.

Hi Bjørn,

For me, I am signing all messages and just removing the "secure" tag
when I am writing on a mailing list or something.

I do this by adding a hook on `message-setup-hook' that calls
`mml-secure-message-encrypt'.

Therefore, you can add a similar hook with the help of a function (or
just lambda), for example:

#+BEGIN_SRC emacs-lisp
(defun my/mml-secure-message-encrypt ()
  "Encrypt all messages when we are sending as [email protected]. Do nothing
for all other From addresses."
  (when (string= message-sendmail-envelope-from
                 "[email protected]")
    (mml-secure-message-encrypt)))

(add-hook 'message-setup-hook #'my/mml-secure-message-encrypt)
#+END_SRC

Let me know if that is what you want or helps at all.

Trevor