Function: message-fetch-field
message-fetch-field is an autoloaded and byte-compiled function
defined in message.el.gz.
Signature
(message-fetch-field HEADER &optional FIRST)
Documentation
Return the value of the header field named HEADER.
Continuation lines are folded (i.e., newlines are removed). Surrounding whitespace is also removed.
By default, if there's more than one header field named HEADER, all the values are returned as one concatenated string, and values are comma-separated.
If FIRST is non-nil, only the first value is returned.
The buffer is expected to be narrowed to just the header of the message;
see message-narrow-to-headers-or-head.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/message.el.gz
(defun message-fetch-field (header &optional first)
"Return the value of the header field named HEADER.
Continuation lines are folded (i.e., newlines are removed).
Surrounding whitespace is also removed.
By default, if there's more than one header field named HEADER,
all the values are returned as one concatenated string, and
values are comma-separated.
If FIRST is non-nil, only the first value is returned.
The buffer is expected to be narrowed to just the header of the message;
see `message-narrow-to-headers-or-head'."
(let* ((value (mail-fetch-field header nil (not first))))
(when value
(while (string-match "\n[\t ]+" value)
(setq value (replace-match " " t t value)))
;; If the initial or final line is blank (just a newline), then
;; we have initial or trailing white space; remove it.
(string-trim value))))