diff options
| author | Glenn Morris | 2011-01-01 18:35:23 -0800 |
|---|---|---|
| committer | Glenn Morris | 2011-01-01 18:35:23 -0800 |
| commit | 8de31eeccbb63764ea3fb95eba819282e3cd92cd (patch) | |
| tree | 5d84e00ece2f67df1951cd83a8a4dcb8284b8dda /lisp/mail | |
| parent | 01e62600950418282e968a74b9163f70c03d8227 (diff) | |
| download | emacs-8de31eeccbb63764ea3fb95eba819282e3cd92cd.tar.gz emacs-8de31eeccbb63764ea3fb95eba819282e3cd92cd.zip | |
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.el | 22 |
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 @@ | |||
| 1 | ;;; mail-utils.el --- utility functions used both by rmail and rnews | 1 | ;;; mail-utils.el --- utility functions used both by rmail and rnews |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1985, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, | 3 | ;; Copyright (C) 1985, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, |
| 4 | ;; 2009, 2010 Free Software Foundation, Inc. | 4 | ;; 2009, 2010, 2011 Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Maintainer: FSF | 6 | ;; Maintainer: FSF |
| 7 | ;; Keywords: mail, news | 7 | ;; Keywords: mail, news |
| @@ -398,13 +398,19 @@ matches may be returned from the message body." | |||
| 398 | (defun mail-mbox-from () | 398 | (defun mail-mbox-from () |
| 399 | "Return an mbox \"From \" line for the current message. | 399 | "Return an mbox \"From \" line for the current message. |
| 400 | The buffer should be narrowed to just the header." | 400 | The buffer should be narrowed to just the header." |
| 401 | (let ((from (or (mail-fetch-field "from") | 401 | (let* ((from (mail-strip-quoted-names (or (mail-fetch-field "from") |
| 402 | (mail-fetch-field "really-from") | 402 | (mail-fetch-field "really-from") |
| 403 | (mail-fetch-field "sender") | 403 | (mail-fetch-field "sender") |
| 404 | (mail-fetch-field "return-path") | 404 | (mail-fetch-field "return-path") |
| 405 | "unknown")) | 405 | "unknown"))) |
| 406 | (date (mail-fetch-field "date"))) | 406 | (date (mail-fetch-field "date")) |
| 407 | (format "From %s %s\n" (mail-strip-quoted-names from) | 407 | ;; A From: header can contain multiple addresses, a "From " |
| 408 | ;; line must contain only one. (Bug#7760) | ||
| 409 | ;; See eg RFC 5322, 3.6.2. Originator Fields. | ||
| 410 | (end (string-match "[ \t]*[,\n]" from))) | ||
| 411 | (format "From %s %s\n" (if end | ||
| 412 | (substring from 0 end) | ||
| 413 | from) | ||
| 408 | (or (and date | 414 | (or (and date |
| 409 | (ignore-errors | 415 | (ignore-errors |
| 410 | (current-time-string (date-to-time date)))) | 416 | (current-time-string (date-to-time date)))) |