11.2 Headers view actions

Suppose we want to inspect the number of recipients for a message in the The headers view. We add the following to our configuration:

(defun show-number-of-recipients (msg)
  "Display the number of recipients for the message at point."
  (message "Number of recipients: %d"
    (+ (length (mu4e-message-field msg :to))
      (length (mu4e-message-field msg :cc)))))

;; define 'N' (the first letter of the description) as the shortcut
;; the 't' argument to add-to-list puts it at the end of the list
(add-to-list 'mu4e-headers-actions
  '("Number of recipients" . show-number-of-recipients) t)

After evaluating this, a N in the headers view shows the number of recipients for the message at point.