5.4 Attachments and MIME-parts

Nowadays, typical e-mail messages can be thought of as a series of “MIME-parts”, which are sections of the message. The most prominent of those parts is the ’body’, which is the main text of the message your are readings.

Other MIME-parts in the messages include attachments.

5.4.1 Attachments

Many e-mail messages also contain attachments, which are MIME-parts that contain files10.

To save such attachments as files on your computer, mu4e’s message-view offers the command mu4e-view-save-attachments; its default keybinding is e (think extract).

Note that when point is on the attachment label in the message, e.g., on something that looks like [4. application/pdf; Some Document.pdf]..., Gnus’ binding for e prevails, which is gnus-mime-view-part-externally. You can of course customize this in the usual (Emacs) way.

After invoking the command, you can enter the file names to save, comma-separated, with completion support. Press RET to save the chosen attachments as files to your computer.

mu4e determines the target directory using the variable mu4e-attachment-dir (which can be either file-system path or a function; see its docstring for details. However, you can manually set the target by calling mu4e-view-save-attachments with a prefix argument.

When completing the file names, mu4e-view-completion-minor-mode is active, which offers mu4e-view-complete-all (bound to C-c C-a to complete all files11.

mu4e-view-save-attachments assumes unique filenames for the attachments, which is requirement of the underlying completion mechanism works. If there are duplicates, only one is recognized.

Furthermore, file names that match crm-separator (by default, commas) are not supported (see completing-read-multiple for further details). For such corner-cases, it is recommended to use mu4e-view-mime-part-action instead, which does not have this limitation.

5.4.2 Other MIME-parts

Not all MIME-parts are message bodies or attachments, and it can be useful to operate on those other parts as well.

To do so, there is mu4e-view-mime-part-action (default key-binding A). You can pass the number of the MIME-part (as seen in the message view) as a prefix argument; otherwise you get to get to choose from a completion menu.

After choosing one or more MIME-parts, you can specify an action to apply to them; see the variable mu4e-view-mime-part-actions for the possibilities. You can add your own actions as well, see MIME-part actions for an example.


Footnotes

(10)

Attachments come in two flavors: inline and attachment. mu4e does not distinguish between the two when operating on them: everything that specifies a filename is considered an attachment

(11)

Except when using ’Helm’; in that case, use the Helm-mechanism for selecting multiple