Klaus Uhl writes: > (add-hook > 'message-send-hook > (lambda () > (let ((recipient (message-fetch-field "To"))) > (cond ((and (not (null recipient)) > (or (pgg-lookup-key recipient) > (pgg-fetch-key pgg-default-keyserver-address recipient))) > (mml-secure-message-encrypt-pgpmime)) > (t > (mml-secure-message-sign-pgpmime)))))) Nice indeed. Been using it today. Then I noticed sometimes it's not able to find the key in my ring or on the server because (message-fetch-field "To") returns the whole header. There is a function to parse a string and get a pair email/name: mail-header-parse-address, so I thought getting only the actual address would be better. So below is a slightly modified version that's been working nice for me for the past... 2 hours or so? Oh, not exactly, one friend had a public key published but didn't use encryption anymore and didn't have the secret counterpart, so he complained I was using cryptography with him... Anyway: (add-hook 'message-send-hook (lambda () (let* ((recipient (message-fetch-field "To")) (recid (if (not (null recipient)) (car (mail-header-parse-address recipient))))) (cond ((and (not (null recipient)) (or (pgg-lookup-key recid) (pgg-fetch-key pgg-default-keyserver-address recid)) ) (mml-secure-message-encrypt-pgpmime)) (t (mml-secure-message-sign-pgpmime)))))) The first (if (not (null recipient)) is to avoid trying to take the car of something bad, dunno if needed really, quite ugly, but safer in my opinion. Cheers Eric