As another example, suppose we would like to search for messages by the sender of the message at point:
(defun search-for-sender (msg)
"Search for messages sent by the sender of the message at point."
(mu4e-search
(concat "from:"
(mu4e-contact-email (car (mu4e-message-field msg :from))))))
;; define 'x' as the shortcut
(add-to-list 'mu4e-view-actions
'("xsearch for sender" . search-for-sender) t)
If you wonder why we use car, remember that the From:-field
is a list of (:name NAME :email EMAIL) plists; so this code gets
us the e-mail address of the first in the list. From:-fields rarely
have more that one address.