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

James Thomas <[email protected]> Sun, 08 Dec 2024 10:35:45 +0530
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.
>
> I'm using gnus-posting-styles to automatically set up things like from
> address, default headers and signature based on context. But I can't
> figure out how to enable automatic signing. A simple approach like
> adding
>
>  (body "<#secure method=pgpmime mode=sign>")
>
> to an existing posting style rule sort of works.  But it fails on
> replies with quoted original text. The body text end up between the
> quoted text and the signature, which obviously makes sense for any
> real
> body.  But the mml tag is not recognised and is sent verbatim.
>
> I tried adding the tag in more complicated ways, using posting style
> eval and a function inserting the mml tag on the first line of the
> body.
> But the message buffer is always empty when this runs, so that doesn't
> work any better.  The tag still ends up the same place.
>
> I guess I'm looking at this the wrong way.  But I'm stuck.
>
> (My elisp skills are extremely limited, so I didn't want to
> re-implement
> the posting style context matching in a sending hook or similar.
> That's
> way out of my league)

This seems to work:

(setq gnus-posting-styles
      '((t
	 (eval (setq-local message-cite-reply-position 'above))
	 (body "<#secure method=pgpmime mode=sign>"))))


Regards,
James