always gpg sign a message in mu4e

265 views
Skip to first unread message

Sam Halliday

unread,
Apr 27, 2014, 6:43:45 PM4/27/14
to mu-di...@googlegroups.com
Hi all,

I have set 

  (add-hook 'message-setup-hook 'mml-secure-sign-pgpmime)

which will always sign my mail when I use "M-x m", but when I use C for compose in mu4e the setting is ignored. What do I need to do to get auto-signing back?

Or, what do I need to do so that compose opens up the standard emacs message window? (and in that case, how do I add the hook to search addresses from mu?)

Best regards,
Sam

Foivos

unread,
Jul 22, 2014, 1:30:40 PM7/22/14
to mu-di...@googlegroups.com
Hi,

You can try signing the message just before sending it.

The following works fine for me

;; PGP-Sign all e-mails
(add-hook 'message-send-hook 'mml-secure-message-sign-pgpmime)

Foivos

nils.s...@gmail.com

unread,
Oct 24, 2017, 4:48:47 AM10/24/17
to mu-discuss
Hi everyone,

do you know if it is possible to always sign e-mails in a specified context.
For example, I have defined a work context and I would like to sign every mail I compose or everytime I am answering an email.
Is there a variable which i can set in the context part of my configuration, as for example the variable related to the signature:
( mu4e-compose-signature-auto-include . nil)

Thanks a lot-
Greets,
Nils

Dirk-Jan C. Binnema

unread,
Oct 24, 2017, 4:13:28 PM10/24/17
to mu-di...@googlegroups.com

On Tuesday Oct 24 2017, nils schween wrote:

> Hi everyone,
>
> do you know if it is possible to always sign e-mails in a specified context.
> For example, I have defined a work context and I would like to sign every
> mail I compose or everytime I am answering an email.
> Is there a variable which i can set in the context part of my
> configuration, as for example the variable related to the signature:
> ( mu4e-compose-signature-auto-include . nil)

You can use e.g. mu4e-compose-mode-hook and have it check for the
current context (`mu4e-context-current'), and based on its value set up
one of the hooks mentioned earlier in this thread.

Good luck!
Dirk.

--
Dirk-Jan C. Binnema Helsinki, Finland
e:dj...@djcbsoftware.nl w:www.djcbsoftware.nl
pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C

nils.s...@gmail.com

unread,
Jan 24, 2018, 6:06:10 AM1/24/18
to mu-discuss
Hi Dirk,

I could re-use a code snippet you posted in a thread called "Adding headers based on context" to write a function signing mails only in a specified context.
Here is the code:
;; Specify the contexts in which emails should be signed.
(defun sign-message-in-specified-context()
   
"Sign messages in a specified context."
   
(let* ((ctx (mu4e-context-current))
           
(name (if ctx (mu4e-context-name ctx))))
     
(when name
       
(cond
         
((string= name "account1")
     
(mml-secure-message-sign-pgpmime))
     
;; ((string= name "account2")
     
;;  (mml-secure-message-sign-pgpmime))
     
))))
(add-hook 'message-send-hook 'sign-message-in-specified-context)


The only question is if gpg automatically recognizes what key to use to sign a message.
For one context, it works perfectly. Thanks.

Maybe one day it will possible to include it under the :vars in the context specifications.
A variable mu4e-compose-signature-auto-include would do the job.

Thanks.
Nils

On Tuesday, 24 October 2017 22:13:28 UTC+2, djcb wrote:

On Tuesday Oct 24 2017, nils schween wrote:

> Hi everyone,
>
> do you know if it is possible to always sign e-mails in a specified context.
> For example, I have defined a work context and I would like to sign every
> mail I compose or everytime I am answering an email.
> Is there a variable which i can set in the context part of my
> configuration, as for example the variable related to the signature:
> ( mu4e-compose-signature-auto-include . nil)

You can use e.g. mu4e-compose-mode-hook and have it check for the
current context (`mu4e-context-current'), and based on its value set up
one of the hooks mentioned earlier in this thread.

Good luck!
Dirk.

--
Dirk-Jan C. Binnema                  Helsinki, Finland
Reply all
Reply to author
Forward
0 new messages