diff --git a/mu4e/mu4e-actions.el b/mu4e/mu4e-actions.el index 9a63c326..8e4b245e 100644 --- a/mu4e/mu4e-actions.el +++ b/mu4e/mu4e-actions.el @@ -71,6 +71,19 @@ Works for the message view." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun mu4e~action-header-to-html (msg field) + "Convert the FIELD of MSG to an HTML string." + (mapconcat + (lambda(c) + (let* ((name (when (car c) + (replace-regexp-in-string "[[:cntrl:]]" "" (car c)))) + (email (when (cdr c) + (replace-regexp-in-string "[[:cntrl:]]" "" (cdr c)))) + (short (or name email)) ;; name may be nil + (long (if name (format "%s <%s>" name email) email))) + (if mu4e-view-show-addresses long short))) + (mu4e-message-field msg field) ", ")) + (defun mu4e~write-body-to-html (msg) "Write MSG's body (either html or text) to a temporary file; return the filename." @@ -86,9 +99,9 @@ return the filename." (with-temp-buffer (insert "\n") (insert (concat "

From: " - (mu4e~view-construct-contacts-header msg :from) "
")) + (mu4e~action-header-to-html msg :from) "
")) (insert (concat "To: " - (mu4e~view-construct-contacts-header msg :to) "
")) + (mu4e~action-header-to-html msg :to) "
")) (insert (concat "Date: " (format-time-string mu4e-view-date-format (mu4e-message-field msg :date)) "
")) (insert (concat "Subject: " (mu4e-message-field msg :subject) "

"))