[Home]MuttFaq/Attachment

MuttWiki | MuttFaq | RecentChanges | Preferences | EDITwiki

How to save all attachments into the same directory, easily?!

Mutt 1.5.13 (2006-08-11):

View attachments, tag the ones you want to save, then use "tag-save" ("<tag-prefix><save-entry>"). Enter the directory to save under (no filename) and you'll be prompted: "File is a directory, save under it? [(y)es, (n)o, (a)ll]". The "a" option does what you want it to, and you get a chance to approve each save individually as well (in case you want to change a filename here or there).

Another solution that will work:

Quit mutt, then start mutt in the directory you want to save them, then enter "view attachments" mode, "tag" them all and then save them. See '?' on-line help for the keys to the functions.

Or define these macro:

 macro attach W <save-entry><kill-line>/home/gawron/attachments/
 macro attach E <save-entry><kill-line>/home/gawron/attachments/<enter>
This will either save automatically (E) to a given dir with a single keystrike, or (W) give you a default path to either confirm or expand and then to save. As with all MuttGuide/Macros, they can't be used with tga-prefix.

How to use different mailcap entries based on whether X is running:

The mailcap file has a "test=" field. If the part after the "=" evaluates to false, then the line is skipped and the program reading .mailcap searches for a subsequent line with a matching MIME type. This can be used for lots of slick stuff, but the focus here is whether X is running and accessable. To check that, and easy method is to see if the $DISPLAY variable is set:
 test=test -n "$DISPLAY"

Don't be confused by the second "test," it's just one alias of the "[" program, so the command 'test -n "$DISPLAY"' is the same as '[ -n "$DISPLAY" ]'.

An example with text files then would be to add the following lines to your ~/.mailcap:

 # If $DISPLAY is set, open it in 'xless,' the X11 version of classic 'less'
 text/*; xless '%s'; test=test -n "$DISPLAY"
 # If it's not set, we can't use X, so fall back on the usual console pager, 'less'
 text/*; less '%s'

Only one "test=" field is allowed per line, so every association on a line is linked to the "success" of that field. The next example uses this to define numerous fields for each of the X running/X not running lines:

 #If $DISPLAY is set, use X-based counterparts
 text/html; mozilla %s; test=test -n "$DISPLAY"; edit=gvim; compose=gvim; nametemplate=%s.html
 #Fallback if X isn't available
 text/html; w3m -v -F -T text/html %s; edit=vim; compose=vim; nametemplate=%s.html; needsterminal

How to view/ reply HTML, images and other non-textual attachments?

Please read carefully [section 5] of the mutt manual, in particular 5.3.1 mailcap basics and 5.4!
Once you got that, check out the UserPages for help applications to display various data formats, especially Dave Pearson's.

in mailcap:

 ##this is used when (v)iewing a text/html attachment:
 ##allowing you to browse and "click" links
 ##order matters the first entry which passes the test is used
 #gui browser if $DISPLAY is set
 text/html; mozilla %s; test=test -n "$DISPLAY"; nametemplate=%s.html
 #text browser otherwise
 text/html; w3m -v -F -T text/html %s; nametemplate=%s.html; needsterminal

 ##auto_view will use the entry with the copiousoutput part:
 text/html; lynx -stdin -dump -force_html ; copiousoutput
in muttrc:
 #if there is only html dump that
 auto_view text/html

 muttrc:
 # this helps with multipart messages
 alternative_order text/plain text/html

For images you can use "aview" from the "aalib" project: http://aa-project.sourceforge.net/

However, you'll need to patch it to use it as filter to display with mutt's built-in pager.

How to make M$-office attachments accessible?

Uh, oh, better don't try but convince people to use portable formats. :)

Seriously, if you really must, use something like openOffice or some other simpler MuttTools like antiword, or have a look at Gary Johnson's UserPages.

In 1.5.X there is a new setting that helps with application/octet-stream attachments. mime_lookup. See [manual section 5.6]

 mime_lookup application/octet-stream
Everybody should set this.

How do I forward a message including attachments?

Add
 set mime_forward=yes
 set mime_forward_rest=yes
to your ~/.muttrc. This will cause Mutt to attach the message rather than quoting it in the body of the message.
Otherwise use "bounce".

But I want to add my own comments to the top of the forwarded message, how to do that?

Mutt does not support quoting the first part and attaching the rest of the parts. Just add your comments like you were sending a new message. Another way is to go to the attachment-menu, tag all attachments you want to forward and invoke "tag-prefix" + "forward" (by default press ";f", hit "?" for your keymap).

How to make mutt use a correct content-type (data-format) for attachments I send out?

Have a look at section 5 of the manual.txt. In particular learn about how to setup a proper mime.types file. With that you must tell which files are assigned which MIME types/ formats.

Can mutt stop me from making me look stupid by sending mails saying "patch attached" without attachments?

Yes! :) See ConfigTricks/CheckAttach.

MuttWiki | MuttFaq | RecentChanges | Preferences | EDITwiki
Read EDITwiki in nav-bar!!! | View other revisions
Last edited June 10, 2008 6:57 am by Rcbarnes (diff)
Search: