12.3 Message functions

Many functions in mu4e deal with message plists (property lists). They contain information about messages, such as sender and recipient, subject, date and so on. To deal with these plists, there are a number of mu4e-message- functions (in mu4e-message.el), such as mu4e-message-field and mu4e-message-at-point, and a shortcut to combine the two, mu4e-message-field-at-point.

For example, to get the subject of the message at point, in either the headers view or the message view, you could write:

(mu4e-message-field (mu4e-message-at-point) :subject)

Note that:

Note that in headers-mode, you only have access to a reduced message plist, without the information about the message-body or mime-parts; mu4e does this for performance reasons. And even in view-mode, you do not have access to arbitrary message-headers.

However, it is possible to get the information indirectly, using the raw-message and some third-party tool like procmail’s formail:

(defun my-mu4e-any-message-field-at-point (hdr)
  "Quick & dirty way to get an arbitrary header HDR at
point. Requires the 'formail' tool from procmail."
  (replace-regexp-in-string "\n$" ""
      (concat "formail -x " hdr " -c < "
        (shell-quote-argument (mu4e-message-field-at-point :path))))))