summaryrefslogtreecommitdiff
path: root/lisp/mail
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2011-01-01 18:35:23 -0800
committerGlenn Morris <rgm@gnu.org>2011-01-01 18:35:23 -0800
commit8de31eeccbb63764ea3fb95eba819282e3cd92cd (patch)
tree5d84e00ece2f67df1951cd83a8a4dcb8284b8dda /lisp/mail
parent01e62600950418282e968a74b9163f70c03d8227 (diff)
downloademacs-8de31eeccbb63764ea3fb95eba819282e3cd92cd.tar.gz
Small mail-utils fix for bug 7760.
* lisp/mail/mail-utils.el (mail-mbox-from): Handle From: headers with multiple addresses.
Diffstat (limited to 'lisp/mail')
-rw-r--r--lisp/mail/mail-utils.el22
1 files changed, 14 insertions, 8 deletions
diff --git a/lisp/mail/mail-utils.el b/lisp/mail/mail-utils.el
index a8def04100e..19ddada1025 100644
--- a/lisp/mail/mail-utils.el
+++ b/lisp/mail/mail-utils.el
@@ -1,7 +1,7 @@
;;; mail-utils.el --- utility functions used both by rmail and rnews
;; Copyright (C) 1985, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
-;; 2009, 2010 Free Software Foundation, Inc.
+;; 2009, 2010, 2011 Free Software Foundation, Inc.
;; Maintainer: FSF
;; Keywords: mail, news
@@ -398,13 +398,19 @@ matches may be returned from the message body."
(defun mail-mbox-from ()
"Return an mbox \"From \" line for the current message.
The buffer should be narrowed to just the header."
- (let ((from (or (mail-fetch-field "from")
- (mail-fetch-field "really-from")
- (mail-fetch-field "sender")
- (mail-fetch-field "return-path")
- "unknown"))
- (date (mail-fetch-field "date")))
- (format "From %s %s\n" (mail-strip-quoted-names from)
+ (let* ((from (mail-strip-quoted-names (or (mail-fetch-field "from")
+ (mail-fetch-field "really-from")
+ (mail-fetch-field "sender")
+ (mail-fetch-field "return-path")
+ "unknown")))
+ (date (mail-fetch-field "date"))
+ ;; A From: header can contain multiple addresses, a "From "
+ ;; line must contain only one. (Bug#7760)
+ ;; See eg RFC 5322, 3.6.2. Originator Fields.
+ (end (string-match "[ \t]*[,\n]" from)))
+ (format "From %s %s\n" (if end
+ (substring from 0 end)
+ from)
(or (and date
(ignore-errors
(current-time-string (date-to-time date))))