Function: eudc-rfc5322-make-address
eudc-rfc5322-make-address is a byte-compiled function defined in
eudc.el.gz.
Signature
(eudc-rfc5322-make-address ADDRESS &optional FIRSTNAME NAME COMMENT)
Documentation
Create a valid address specification according to RFC5322.
RFC5322 address specifications are used in message header fields to indicate senders and recipients of messages. They generally have one of the forms:
ADDRESS ADDRESS (COMMENT) PHRASE <ADDRESS> PHRASE <ADDRESS> (COMMENT)
The arguments FIRSTNAME and NAME are combined to form PHRASE. PHRASE is enclosed in double quotes if necessary.
COMMENT is omitted if it contains any symbols outside the
permitted set eudc-rfc5322-cctext-token.
Source Code
;; Defined in /usr/src/emacs/lisp/net/eudc.el.gz
(defun eudc-rfc5322-make-address (address &optional firstname name comment)
"Create a valid address specification according to RFC5322.
RFC5322 address specifications are used in message header fields
to indicate senders and recipients of messages. They generally
have one of the forms:
ADDRESS
ADDRESS (COMMENT)
PHRASE <ADDRESS>
PHRASE <ADDRESS> (COMMENT)
The arguments FIRSTNAME and NAME are combined to form PHRASE.
PHRASE is enclosed in double quotes if necessary.
COMMENT is omitted if it contains any symbols outside the
permitted set `eudc-rfc5322-cctext-token'."
(if (and address
(not (string-blank-p address)))
(let ((result address)
(name-given (and name
(not (string-blank-p name))))
(firstname-given (and firstname
(not (string-blank-p firstname))))
(valid-comment-given (and comment
(not (string-blank-p comment))
(eudc-rfc5322-valid-comment-p comment))))
(if (or name-given firstname-given)
(let ((phrase (string-trim (concat firstname " " name))))
(setq result
(concat
(eudc-rfc5322-quote-phrase phrase)
" <" result ">"))))
(if valid-comment-given
(setq result
(concat result " (" comment ")")))
result)
;; nil or empty address, nothing to return
nil))