mu4e lets you define custom actions for messages in The headers view and
for both messages and attachments in the The message view. Custom actions
allow you to easily extend mu4e for specific needs — for example, marking
messages as spam in a spam filter or applying an attachment with a source code
patch.
You can invoke the actions with key a for actions on messages, and key A for actions on attachments.
For general information extending mu4e and writing your own functions, see
Extending mu4e.