Next: , Previous: , Up: Message view   [Contents]


5.3 Attachments

By default, mu4e uses the xdg-open-program 23 or (on OS X) the open program for opening attachments. If you want to use another program, you do so by setting the MU_PLAY_PROGRAM environment variable to the program to be used.

The default directory for extracting (saving) attachments is your home directory (~/); you can change this using the variable mu4e-attachment-dir, for example:

(setq mu4e-attachment-dir  "~/Downloads")

For more flexibility, mu4e-attachment-dir can also be a user-provided function. This function receives two parameters: the file-name and the mime-type as found in the e-mail message24 of the attachment, either or both of which can be nil. For example:

(setq mu4e-attachment-dir
  (lambda (fname mtype)
     (cond
        ;; docfiles go to ~/Desktop
       ((and fname (string-match "\\.doc$" fname))  "~/Desktop")
       ;; ... other cases  ...
       (t "~/Downloads")))) ;; everything else

You can extract multiple attachments at once by prefixing the extracting command by C-u; so C-u e asks you for a range of attachments to extract (for example, 1 3-6 8). The range "‘a’" is a shortcut for all attachments.


Footnotes

(23)

http://portland.freedesktop.org/wiki/

(24)

sadly, often application/octet-stream is used for the mime-type, even if a better type is available