Function: mail-mbox-from

mail-mbox-from is a byte-compiled function defined in mail-utils.el.gz.

Signature

(mail-mbox-from)

Documentation

Return an mbox "From " line for the current message.

The buffer should be narrowed to just the header.

Source Code

;; Defined in /usr/src/emacs/lisp/mail/mail-utils.el.gz
(defun mail-mbox-from ()
  "Return an mbox \"From \" line for the current message.
The buffer should be narrowed to just the header."
  (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, e.g., 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))))
		(current-time-string)))))