X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/d1d6801eb4badab97416d0b6294e1920d0f90c3e..4e05e67e4cd0bc1b0a4ef3176a4d0d91c6b3738e:/lisp/epa-mail.el diff --git a/lisp/epa-mail.el b/lisp/epa-mail.el index 09b3086811..6e35854111 100644 --- a/lisp/epa-mail.el +++ b/lisp/epa-mail.el @@ -1,5 +1,5 @@ ;;; epa-mail.el --- the EasyPG Assistant, minor-mode for mail composer -;; Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2006-2011 Free Software Foundation, Inc. ;; Author: Daiki Ueno ;; Keywords: PGP, GnuPG, mail, message @@ -117,23 +117,29 @@ Don't use this command in Lisp programs!" (save-excursion (let ((verbose current-prefix-arg) (context (epg-make-context epa-protocol)) - recipients recipient-key) + recipients-string recipients recipient-key) (goto-char (point-min)) (save-restriction (narrow-to-region (point) (if (search-forward mail-header-separator nil 0) (match-beginning 0) (point))) + (setq recipients-string + (mapconcat #'identity + (nconc (mail-fetch-field "to" nil nil t) + (mail-fetch-field "cc" nil nil t) + (mail-fetch-field "bcc" nil nil t)) + ",")) (setq recipients (mail-strip-quoted-names - (mapconcat #'identity - (nconc (mail-fetch-field "to" nil nil t) - (mail-fetch-field "cc" nil nil t) - (mail-fetch-field "bcc" nil nil t)) - ",")))) + (with-temp-buffer + (insert "to: " recipients-string "\n") + (expand-mail-aliases (point-min) (point-max)) + (car (mail-fetch-field "to" nil nil t)))))) (if recipients (setq recipients (delete "" - (split-string recipients "[ \t\n]+")))) + (split-string recipients + "[ \t\n]*,[ \t\n]*")))) (goto-char (point-min)) (if (search-forward mail-header-separator nil t) (forward-line)) @@ -154,7 +160,9 @@ If no one is selected, symmetric encryption will be performed. " (epa-mail--find-usable-key (epg-list-keys (epg-make-context epa-protocol) - (concat "<" recipient ">")) + (if (string-match "@" recipient) + (concat "<" recipient ">") + recipient)) 'encrypt)) (unless (or recipient-key (y-or-n-p @@ -189,5 +197,4 @@ Don't use this command in Lisp programs!" (provide 'epa-mail) -;; arch-tag: a6f82b3f-d177-4a11-af95-040da55927d2 ;;; epa-mail.el ends here