Emacs and XEmacs come with different mail and news reading packages. In the following the support for the news and mail reader Gnus by the package Mailcrypt is descriped. Mailcrypt also supports the mail readers VM, RMAIL and MH-E.
GnuPG support is part of Mailcryptversion 3.5.5 which can be downloaded via http://www.nb.net/~lbudney/linux/software/mailcrypt.html. Mailcrypt comes with its own manual which explains everything better than I do. This section is just a shortcut for the lazy.
You need to install Mailcrypt on your disk and then run ./configure and make to bytecompile everything. You can either have mailcrypt installed in your home directory or put it in the global (X)Emacs directories with make install. If you install it locally, you need to tell your emacsen where it lives with setting the load-path in your ~/.emacs file e.g.
(setq load-path
(cons "/home/aj/ELisp/mailcrypt-3.5.5" load-path))
To hook Mailcrypt in your (X)Emacs, add the following lines to .emacs:
(load-library "mailcrypt") (mc-setversion "gpg") (autoload 'mc-install-write-mode "mailcrypt" nil t) (autoload 'mc-install-read-mode "mailcrypt" nil t) (add-hook 'gnus-summary-mode-hook 'mc-install-read-mode) (add-hook 'message-mode-hook 'mc-install-write-mode) (add-hook 'news-reply-mode-hook 'mc-install-write-mode)Next time you start Gnus, you get a menu called ¨Mailcrypt¨ which gives you an easy access to GnuPG.
Some variable settings which might be helpful are:
;; Use the pgp2 compatibility wrapper (setq mc-gpg-path "/usr/bin/gpg-compat") ;; If you have more than one key, specify the one to use (setq mc-gpg-user-id "0x12345678") ;; Always sign encrypted messages (setq mc-pgp-always-sign t) ;; How long should mailcrypt remember your passphrase (setq mc-passwd-timeout 600)
To sign automatically every message you send, you need to add some lisp code. After adding the following lines to your .emacs file, (X)Emacs will ask you if the message is to be signed before sending it.
(add-hook 'message-send-hook 'my-sign-message)
(defun my-sign-message ()
(if (yes-or-no-p "Sign message? ")
(mc-sign-message)))
Please note that Mailcrypt and Gnus don't support proper MIME handling as specified by the OpenPGP (RFC2440) specification. It just replaces the text.