mu/emacs/mu4e.texi

902 lines
32 KiB
Plaintext
Raw Normal View History

\input texinfo.tex @c -*-texinfo-*-
@c %**start of header
@setfilename mu4e.info
@settitle mu4e user manual
@documentencoding utf-8
@c %**end of header
@dircategory Emacs
@direntry
2011-12-17 10:33:50 +01:00
* mu4e: (mu4e). An email client for emacs based on mu.
@end direntry
@copying
Copyright @copyright{} 2011 Dirk-Jan C. Binnema
@quotation
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts.
@end quotation
@end copying
@node Top
2011-12-17 10:33:50 +01:00
@top mu4e Manual
2011-12-22 23:39:32 +01:00
Welcome to @t{mu4e} (@emph{Mu-For-Emacs})! @t{mu4e} is an @t{emacs}
based e-mail client, based on the @t{mu} e-mail search engine. @t{mu4e}
2011-12-23 15:48:29 +01:00
supports GNU Emacs 23 and later. Also, it assumes a Unix-like system; it has
been tested on Debian GNU/Linux.
2011-12-19 08:07:03 +01:00
@menu
* Introduction::
2011-12-17 10:33:50 +01:00
* Getting started::
* Running mu4e::
2011-12-19 08:07:03 +01:00
* Searching mail::
2011-12-22 23:39:32 +01:00
* How it works::
* Example configuration::
2011-12-19 08:07:03 +01:00
* FAQ - Frequently Anticipated Questions::
* Known issues / missing features::
@end menu
@node Introduction
@chapter Introduction
2011-12-22 23:39:32 +01:00
@t{mu4e} is an e-mail program for @emph{GNU Emacs}; it uses the @t{mu} e-mail
search engine as its backend, making @t{mu} fully search-based.
2011-12-19 08:07:03 +01:00
@menu
2011-12-22 23:39:32 +01:00
* Why another e-mail client?::
* What mu4e does and doesn't do::
2011-12-19 08:07:03 +01:00
@end menu
2011-12-22 23:39:32 +01:00
@node Why another e-mail client?
@section Why another e-mail client?
Why would the world need another e-mail client? Well, I'm not sure the world
needs another one, but maybe @emph{I} do; I spend a @emph{lot} of time (both
professionally and privately) with my e-mail client, so I'd like it to behave
exactly like I want it to. An even more important goal for me was to write
some bigger program in Emacs Lisp (@t{elisp}), to better understand the
language and its idioms.
2011-12-23 15:48:29 +01:00
When it comes to @t{emacs}-based clients, I have tried a few of them. I never
really got into @emph{Gnus}; I think it is by far the most popular
@t{emacs}-based mail client, but I found it hard to make behave the way I like
it; and in particular, I did not like its indirect approach to Maildirs.
2011-12-22 23:39:32 +01:00
2011-12-23 15:48:29 +01:00
@t{mu4e} has things in common with programs such as
2011-12-22 23:39:32 +01:00
@t{notmuch}@footnote{@url{http://notmuchmail.org}} and @t{md}, but - in my
humble opinion- it offers some unique features as well. Basically, the mail
handling (deleting, moving etc.) is inspired by @emph{Wanderlust} (another
2011-12-23 15:48:29 +01:00
emacs-based e-mail client), @t{mutt} and @t{dired}, while it takes some cues
from @emph{GMail} with respect to being search-based.
@t{mu4e} tries to keep all the 'state' in the maildirs, so I can switch
clients, synchronize over @abbr{IMAP} or backup with @t{rsync}.
2011-12-22 23:39:32 +01:00
@node What mu4e does and doesn't do
2011-12-23 18:09:03 +01:00
@section What mu4e does and doesn't do
2011-12-22 23:39:32 +01:00
2011-12-23 15:48:29 +01:00
@t{mu4e} (and @t{mu}) does @emph{not} deal with getting your e-mail messages
from some e-mail server; instead, this task is delegated to other tools, such
as @t{offlineimap} or @t{isync}. As long as the messages end up in a Maildir,
@t{mu4e}/@t{mu} are happy to deal with them.
2011-12-22 23:39:32 +01:00
2011-12-23 15:48:29 +01:00
@t{mu4e} also does @emph{not} implement sending messages; instead, it depends
on the true-and-tested @emph{smtpmail} which is part of emacs. In addition,
@t{mu4e} piggybacks on Gnus' message editor; @inforef{Top,Gnus message
2011-12-22 23:39:32 +01:00
editor,message}.
Thus, many of the traditional things an e-mail client needs to do, are
2011-12-22 23:39:32 +01:00
subcontracted to other tools. This leaves @t{mu4e} to concentrate on what it
does best: quick message searching, reading mails, replying them, moving
messages around and so on.
2011-12-17 10:33:50 +01:00
2011-12-22 23:39:32 +01:00
It's important to note the @t{mu4e} requires your mail to be in
Maildir-format, typically stored in the directory @file{~/Maildir}.
2011-12-17 10:33:50 +01:00
@node Getting started
@chapter Getting started
2011-12-22 23:39:32 +01:00
In this chapter, we will see how you can install @t{mu4e} and how you can
2011-12-19 08:07:03 +01:00
set it up. After we have succeeded in @xref{Getting mail}, and @xref{Indexing
your messages}, we discuss @xref{Basic configuration}. After going through
2011-12-22 23:39:32 +01:00
these steps, @t{mu4e} should be ready for use.
2011-12-19 08:07:03 +01:00
@menu
* Installation::
* Getting mail::
* Indexing your messages::
2011-12-20 07:45:07 +01:00
* Sending mail::
* Queuing mail::
2011-12-19 08:07:03 +01:00
* Basic configuration::
@end menu
2011-12-19 08:07:03 +01:00
@node Installation
@section Installation
2011-12-17 10:33:50 +01:00
2011-12-22 23:39:32 +01:00
@t{mu4e} is part of @t{mu} - by installing the latter, the former will
be installed as well.
2011-12-22 23:39:32 +01:00
At the time of writing, there are no distribution packages for @t{mu4e}
yet, so we are assuming installation from source packages.
Installation follows the normal sequence of:
@example
2011-12-17 10:33:50 +01:00
$ tar xvfz mu-<version>.tar.gz # use the specific version
2011-12-19 08:07:03 +01:00
$ cd mu-<version>
$./configure && make
$ sudo make install
@end example
2011-12-22 23:39:32 +01:00
After this, @t{mu} and @t{mu4e} should be installed @footnote{there's a
hard dependency between versions of @t{mu4e} and @t{mu} - you cannot
2011-12-19 08:07:03 +01:00
combine different versions.}, a be available from the command line and emacs
(respectively). For emacs, you may to restart it so it can pick up
2011-12-22 23:39:32 +01:00
@t{mu4e}.
2011-12-17 10:33:50 +01:00
2011-12-22 23:39:32 +01:00
There is experimental support for using the @t{emacs} customization
system in @t{mu4e}, but for now we recommend setting the values by
2011-12-17 10:33:50 +01:00
manually. Please @ref{Example configuration} for a working example of this.
2011-12-19 08:07:03 +01:00
@node Getting mail
@section Getting mail
2011-12-17 10:33:50 +01:00
2011-12-23 15:48:29 +01:00
In order for @t{mu} (and, by extension, @t{mu4e}) to work, we need to have our
e-mail messages stored in a Maildir. If you were already using Maildirs, you
are lucky; otherwise, you will need to get your mail there in some other way.
2011-12-17 10:33:50 +01:00
2011-12-22 23:39:32 +01:00
If you are using some external @abbr{IMAP} or @abbr{POP} server, you can use
2011-12-23 15:48:29 +01:00
tools like @t{getmail}, @t{offlineimap} or @t{isync} to download your message
into a Maildir-directory (@file{~/Maildir}, usually). If you are using a local
2011-12-22 23:39:32 +01:00
mailserver (such as @emph{Postfix} or @t{qmail}), you can teach them to
2011-12-23 15:48:29 +01:00
deliver into a Maildir as well, maybe in combination with @t{procmail}. A bit
of googling should be able to provide you with the details.
2011-12-17 10:33:50 +01:00
2011-12-19 08:07:03 +01:00
@node Indexing your messages
@section Indexing your messages
After you have succeeded in @ref{Getting mail}, we need to @emph{index}
2011-12-17 10:33:50 +01:00
it. That is - we need to scan the Maildir and store the information about the
2011-12-20 07:45:07 +01:00
mails into a special database. We can do that from @code{mu4e} -- @xref{Main
view}, but for now it's better to do it from the command line, because it's
easier to spot any problems then.
2011-12-17 10:33:50 +01:00
Assuming that your Maildir is at @file{~/Maildir}, you should give the
following command:
@example
$ mu index --maildir=~/Maildir
@end example
This should scan your @file{~/Maildir} and fill the database, and give
progress information while doing so. The first time you index your mail might
take a few minutes (for thousands of e-mails), afterwards it is much faster
since it only has to scan the differences.
2011-12-22 23:39:32 +01:00
Note that indexing is discussed at length in the @t{mu-index} man page.
2011-12-17 10:33:50 +01:00
After the indexing is finished, you can quickly test if everything worked, by
trying some command line searches, for example
@example
$ mu find hello
@end example
2011-12-22 23:39:32 +01:00
which should list all messages that match "hello". The @t{mu-find} man
page describes the various things you can do with @t{mu find}.
2011-12-22 23:39:32 +01:00
If all of this worked well, we are almost ready to start @t{mu4e}.
2011-12-20 07:45:07 +01:00
@node Sending mail
@section Sending mail
2011-12-22 23:39:32 +01:00
@t{mu4e} re-uses Gnu's @t{message mode} @inforef{message}, for writing
2011-12-20 07:45:07 +01:00
mail and inherits the setup for @emph{sending} mail from that.
2011-12-22 23:39:32 +01:00
For sending mail using @abbr{SMTP}, @t{mu4e} uses Emacs's built-in
@t{smtpmail} package -- @inforef{smtpmail}. This package support many
2011-12-20 07:45:07 +01:00
different ways to send mail, please refer to its documentation. Here we
provide some simple examples.
A very minimal setup could look something like:
@verbatim
;; tell message-mode how to send mail
(setq message-send-mail-function 'smtpmail-send-it)
;; if our mail server lives at smtp.example.org; if you have a local
;; mailserver, simply use 'localhost' here.
(setq smtpmail-smtp-server "smtp.example.org")
@end verbatim
2011-12-22 23:39:32 +01:00
Note, since @t{mu4e} uses the same @t{message mode} and @t{smtpmail}
that Gnus uses, any setting for those will also work for @t{mu4e}.
2011-12-20 07:45:07 +01:00
@node Queuing mail
2011-12-22 23:39:32 +01:00
@section Queuing mail
2011-12-20 07:45:07 +01:00
If you cannot send mail directly, for example because you are currently
offline, you can queue the mail, and send it when you have restored your
2011-12-22 23:39:32 +01:00
internet connection. To allow for queueing, you need to tell @t{smtpmail}
2011-12-20 07:45:07 +01:00
where you want to do this. For example:
@verbatim
(setq
smtpmail-queue-mail nil ;; start in non-queing mode
smtpmail-queue-dir "~/Maildir/queue/cur")
@end verbatim
For convenience, we locate the queue directory somewhere in our normal
Maildir. If you want to use queued mail, you should create this directory
2011-12-22 23:39:32 +01:00
before starting @t{mu4e}. The @command{mu mkdir} command can be handy here,
2011-12-20 07:45:07 +01:00
so for example:
@verbatim
$ mu mkdir ~/Maildir/queue
$ touch ~/Maildir/queue/.noindex
@end verbatim
2011-12-22 23:39:32 +01:00
The @command{touch} command tells @t{mu} to ignore this directory for
2011-12-20 07:45:07 +01:00
indexing, which makes sense since it does not just consist of 'normal'
2011-12-22 23:39:32 +01:00
messages but also some of the @t{smtpmail} metadata.
2011-12-20 07:45:07 +01:00
2011-12-22 23:39:32 +01:00
Also see @t{mu-mkdir} and @t{mu-index} man pages.
2011-12-19 08:07:03 +01:00
@node Basic configuration
@section Basic configuration
2011-12-17 10:33:50 +01:00
2011-12-22 23:39:32 +01:00
The last thing to do before running @t{mu4e} is setting up some basic
2011-12-17 10:33:50 +01:00
configuration. A good place to put this would be in your @file{~/.emacs} file.
2011-12-22 23:39:32 +01:00
First, we need to load @t{mu4e}:
2011-12-17 10:33:50 +01:00
@example
(require 'mu4e)
@end example
2011-12-22 23:39:32 +01:00
Then, we need to tell @t{mu4e} where it can find your Maildir, and some
2011-12-17 10:33:50 +01:00
special folders. So for example:
@example
(setq
mu4e-maildir "~/Maildir"
mu4e-inbox-folder "/inbox" ;; where do i receive mail?
mu4e-sent-folder "/sent" ;; where do i keep sent mail?
mu4e-drafts-folder "/drafts" ;; where do i keep half-written mail?
mu4e-trash-folder "/trash" ;; where do i move deleted mail?
@end example
The folder names are all relative to @code{mu4e-maildir}.
2011-12-19 08:07:03 +01:00
@node Running mu4e
@chapter Running mu4e
After the following the steps in @xref{Getting started}, we should now have a
2011-12-22 23:39:32 +01:00
working @t{mu4e} setup. In this chapter, we'll give a tour of the
@t{mu4e} programming, and show its use.
2011-12-19 08:07:03 +01:00
2011-12-22 23:39:32 +01:00
@t{mu4e} consists of a number of views; the diagram shows how they relate
2011-12-19 08:07:03 +01:00
to eachother, and the default keybindings to from one view to the next. In the
next sections we will describe what these keys actually @emph{do}.
@menu
* Main view::
* Headers view::
* Message view::
* Editor view::
@end menu
@example
2011-12-19 08:07:03 +01:00
[C] +--------+ [RFCE]
--------> | editor | <--------
/ +--------+ \
/ [RFCE]^ \
/ | \
+-------+ [sjb] +---------+ [RET] +---------+
| main | <---> | headers | <----> | message |
+-------+ [q] +---------+ [qbjs] +---------+
[sbj] ^
[.] | [q]
V
+-----+
| raw |
+-----+
Default bindings
----------------
R: Reply s: search .: raw view
F: Forward j: jump-to-maildir
C: Compose b: bookmark-search
E: Edit q: quit
@end example
2011-12-19 08:07:03 +01:00
@node Main view
@section Main view
2011-12-22 23:39:32 +01:00
After you've installed @t{mu4e} (@pxref{Getting started}), you can start it
2011-12-17 10:33:50 +01:00
with @code{M-x mu4e}. This will do some checks to ensure everything is set up
2011-12-22 23:39:32 +01:00
correctly, and then show the @t{mu4e} main view.
2011-12-19 08:07:03 +01:00
This looks something like the following:
2011-12-17 10:33:50 +01:00
--
2011-12-17 10:33:50 +01:00
@verbatim
2011-12-19 08:07:03 +01:00
* mu4e - mu for emacs version x.x
2011-12-17 10:33:50 +01:00
Basics
* [j]ump to some maildir
* enter a [s]earch query
2011-12-19 08:07:03 +01:00
* [C]ompose a new message
2011-12-17 10:33:50 +01:00
Bookmarks
* [bu] Unread messages
* [bt] Today's messages
* [bw] Last 7 days
* [bp] Messages with images
Misc
2011-12-19 08:07:03 +01:00
* [U]pdate email & database
2011-12-17 10:33:50 +01:00
* toggle [m]ail sending mode (direct)
* [f]lush queued mail
2011-12-19 08:07:03 +01:00
* [H]elp
* [q]uit mu4e
2011-12-17 10:33:50 +01:00
@end verbatim
--
2011-12-17 10:33:50 +01:00
First, the @emph{Basics}:
@itemize
2011-12-22 23:39:32 +01:00
@item @t{[j]ump to some maildir} means that after pressing @key{j},
@t{mu4e} will ask you for a maildir to jump to. These are the maildirs you
2011-12-19 08:07:03 +01:00
set in @xref{Basic configuration}.
2011-12-22 23:39:32 +01:00
@item @t{enter a [s]earch query} means that after pressing @key{s} you will
2011-12-19 08:07:03 +01:00
be asked for a search query, and after entering one, the results will be shown.
2011-12-22 23:39:32 +01:00
@item @t{[C]ompose a new message} means that after pressing @key{C}, you
2011-12-19 08:07:03 +01:00
will be thrown you in a message-editing buffer, where you can write a new message.
@end itemize
Next come the @emph{Bookmarks}.These are set in @code{mu4e-bookmarks}; what
you see in the above example are the @emph{default}, but you can add your own
and/or replace the default ones. See @xref{Bookmarks}.
2011-12-19 08:07:03 +01:00
Finally, there are some @emph{Misc} actions:
@itemize
2011-12-22 23:39:32 +01:00
@item @t{[U]pdate email & database} will execute whatever is in
@code{mu4e-get-mail-command}, and afterwards update the @t{mu} database;
2011-12-20 07:45:07 +01:00
@xref{Indexing your messages}. This is a synchronous command.
2011-12-22 23:39:32 +01:00
@item @t{toggle [m]ail sending mode (direct)} will toggle between sending
2011-12-19 08:07:03 +01:00
mail directly, and queuing it first (for example, when you are offline), and
2011-12-22 23:39:32 +01:00
@t{[f]lush queued mail} will flush any queued mail.
@item @t{[H]elp} will show help information for this view.
@item Finally, @t{[q]uit mu4e} will quit @t{mu4e}.
2011-12-19 08:07:03 +01:00
@end itemize
@node Headers view
@section Headers view
The headers view shows the results of search queries. There's one line for
each matching message, and each line shows a number of fields describing this
message.
2011-12-20 07:45:07 +01:00
--
2011-12-19 08:07:03 +01:00
@verbatim
2011-12-22 23:39:32 +01:00
* Date Flags From/To Subject
2011-12-16 18:38 uN To Edmund Dantès + Re: Extension security?
2011-12-16 21:44 uN Abbé Busoni + Re: Extension security?
2011-12-17 03:14 uN Pierre Morrel + Re: Extension security?
2011-12-17 04:04 uN Jacopo + Re: Extension security?
2011-12-17 14:36 uN Mercédès + Re: Extension security?
2011-12-18 06:05 uN Beachamp \ Re: Extension security?
2011-12-16 18:23 uN Eric Schulte + Re: [O] A presentation tool for org-mode
2011-12-17 01:53 usaN Gaspard Caderousse \ Re: [O] A presentation tool for org-mode
2011-12-16 16:31 uN Baron Danglars | [O] imaxima?
2011-12-19 08:07:03 +01:00
End of search results
@end verbatim
2011-12-20 07:45:07 +01:00
--
2011-12-19 08:07:03 +01:00
It should be fairly obvious what this means, but some notes:
@itemize
@item The fields shown in the headers view can be influenced by customizing
2011-12-22 23:39:32 +01:00
@t{mu4e-headers-fields}
2011-12-19 08:07:03 +01:00
@item You can change the date format by customizing
2011-12-22 23:39:32 +01:00
@t{mu4e-headers-date-format}
2011-12-19 08:07:03 +01:00
@item The letters in the 'Flags' field correspond to the following: D=draft,
F=flagged, N=new, P=passed (i.e.., forwarded), R=replied, S=seen, T=trashed,
a=has-attachment, x=encrypted, s=signed, u=unread.
@item The From/To field shows the sender of the message unless the sender
2011-12-22 23:39:32 +01:00
matches the regular expression in @t{mu4e-user-mail-address-regexp}, in
which the header will show @t{To} followed by the recipient.
2011-12-19 08:07:03 +01:00
@item The subject field displays the discussion threads according to the @emph{JWZ mail
2011-12-22 23:39:32 +01:00
threading algorithm}@footnote{@url{http://www.jwz.org/doc/threading.html}}.
2011-12-17 10:33:50 +01:00
@end itemize
2011-12-19 08:07:03 +01:00
Using the default key bindings, you can do various things with these messages;
2011-12-22 23:39:32 +01:00
note that these actions are also listed in the @t{Headers} menu in the
2011-12-19 08:07:03 +01:00
Emacs menu bar.
2011-12-17 10:33:50 +01:00
@verbatim
key description
--- -----------
d mark for moving to the trash folder
DEL,D mark for immediate deletion
m mark for moving to another maildir folder
u unmark message at point
U unmark *all* messages
x execute actions for the marked messages
RET open the message at point in the message view
R,F,C reply/forward/compose
E edit (only allowed for draft messages)
H get help
q leave the headers buffer
@end verbatim
2011-12-19 08:07:03 +01:00
Note, all the mark/unmark commands support the current @emph{region} (i.e.,
selection) -- so, for example, if you the select a number of message and then
press @key{DEL}, all selected message will be marked for deletion.
2011-12-17 10:33:50 +01:00
2011-12-22 23:39:32 +01:00
Tne two-step mark-execute sequence is similar to what for example @t{Dired}
2011-12-19 08:07:03 +01:00
does, and tries to be as fast as possible while still trying to protect the
user against accidents.
2011-12-17 10:33:50 +01:00
2011-12-19 08:07:03 +01:00
@node Message view
@section Message view
2011-12-17 10:33:50 +01:00
2011-12-19 08:07:03 +01:00
After selecting a message in the Headers view (@ref{Headers view}), the
message will be show in the message view. This might look something like the
following:
2011-12-20 07:45:07 +01:00
--
2011-12-19 08:07:03 +01:00
@verbatim
From: info@galatians.net
To: "Paul" paul@hotmail.com
Subject: Re: some thoughts
Flags: (seen attach)
Date: Mon 19 Jan 2004 09:39:42 AM EET
Maildir: /inbox
Attachments(2): [1]DSCN4961.JPG(1.3M), [2]DSCN4962.JPG(1.4M)
2011-12-19 08:07:03 +01:00
Hi Paul,
2011-12-19 08:07:03 +01:00
How are you? Sorry we didn't get back to you sooner and sorry for the
top-quoting. We're still debating your last message; anyway, here are some
recent pics. And here's a link: http://example.com[1]
2011-12-19 08:07:03 +01:00
All the best!
2011-12-19 08:07:03 +01:00
On Sun 21 Dec 2003 09:06:34 PM EET, Paul wrote:
[....]
@end verbatim
2011-12-20 07:45:07 +01:00
--
2011-12-19 08:07:03 +01:00
Some notes:
@itemize
@item You can customize which header fields are shown using
2011-12-22 23:39:32 +01:00
@t{mu4e-view-fields}.
2011-12-23 15:48:29 +01:00
@item You can customize the date format by setting
@code{mu4e-date-format-long}, using the format of @code{format-time-string}.
2011-12-19 08:07:03 +01:00
@end itemize
You can find most things you can do with this message in the @emph{View} menu,
or use the keyboard -- the default bindings are:
@verbatim
key description
--- -----------
n,p go to next, previous message
d mark for moving to the trash folder
DEL,D mark for immediate deletion
m mark for moving to another maildir folder
u unmark message at point
R,F,C reply/forward/compose
E edit (only allowed for draft messages)
. show the raw message view. '.'/'q' take you back
| pipe the message through a shell command
g go to (visit) numbered URL (using `browse-url')
e,o extract, open numbered attachment
w toggle line wrapping
h toggle showing cited parts
H get help
q leave the headers buffer
@end verbatim
2011-12-19 08:07:03 +01:00
Note that @key{x}, which means 'execute actions on marked messages' is not
available in this view, to reduce the risk of accidents. You have to go back
to the headers view to effectuate the actions.
2011-12-19 08:07:03 +01:00
2011-12-22 23:39:32 +01:00
Also note that opening of an attachment uses the @t{xdg-open} programming
to determine the right program to use for a certain attachment.
2011-12-19 08:07:03 +01:00
2011-12-22 23:39:32 +01:00
For displaying messages, @t{mu4e} normally prefers the plain text version
2011-12-20 07:45:07 +01:00
if the message consists of both a textversion and an html version of its
contents. If there is only an html-version, or if the text part is too short
2011-12-22 23:39:32 +01:00
in comparison with the html part, @t{mu4e} tries to convert the html into
2011-12-20 07:45:07 +01:00
plain text for display. The default way to do that is to use the Emacs
built-in @code{html2text} function, but if you set
@code{mu4e-html2text-command} to some external program, that will be
used. This is expected to take html from standard input and write plain text
on standard output.
2011-12-19 08:07:03 +01:00
@node Editor view
@section Editor view
2011-12-22 23:39:32 +01:00
Currently, @t{mu4e} uses Gnu's message editor, so for documentation
2011-12-20 07:45:07 +01:00
@inforef{Message}.
2011-12-19 08:07:03 +01:00
2011-12-21 23:45:06 +01:00
Also, @xref{Sending mail}.
2011-12-19 08:07:03 +01:00
@node Searching mail
@chapter Searching mail
2011-12-22 23:39:32 +01:00
@t{mu4e} is fully search-based; this means that all the lists of messages
you see, are the result of some query. Even if you 'jump to a folder', in fact
you are executing a search query for messages that have the property of being
in a certain folder.
Note, all queries normally return only up to @code{mu4e-search-results-limit}
results; if you need more than that, prefix your search command with
@kbd{C-u}.
2011-12-19 08:07:03 +01:00
@menu
* Queries::
* Bookmarks::
* Maildir searches::
@end menu
@node Queries
@section Queries
The queries you can execute are the same that @code{mu find}
understands. Please refer to the @code{mu-find} man-page for details. Here, we
just provide a few examples.
@verbatim
# get all messages about bananas
bananas
# get all messages about bananas from john with an attachment
from:john flag:attach bananas
# get all messages with subject wombat in June 2009
subject:wombat date:20090601..20090630
# get all messages with PDF attachments in the /projects folder
maildir:/projects mime:application/pdf
@end verbatim
2011-12-19 08:07:03 +01:00
@node Bookmarks
@section Bookmarks
If you have queries that you use often, you may want to store them as
@emph{bookmarks}. These bookmarks then show up in the main view. By default,
bookmark searches are available in the main view @ref{Main view}, header
view @xref{Headers view}, and message view @xref{Message view}, with the key
@kbd{b} for @code{mu4e-search-bookmark}.
@code{mu4e} provides some default bookmarks which you of course can
override. The definition of the default bookmarks is instructive here:
@example
(defvar mu4e-bookmarks
'( ("flag:unread AND NOT flag:trashed" "Unread messages" ?u)
("date:today..now" "Today's messages" ?t)
("date:7d..now" "Last 7 days" ?w)
("mime:image/*" "Messages with images" ?p))
"A list of pre-defined queries; these will show up in the main
screen. Each of the list elements is a three-element list of the
form (QUERY DESCRIPTION KEY), where QUERY is a string with a mu
query, DESCRIPTION is a short description of the query (this will
show up in the UI), and KEY is a shortcut key for the query.")
@end example
Thus, you can replaces this or add your own items, by putting in your
configuration (@file{~/.emacs}) something like:
@example
(add-to-list 'mu4e-bookmarks
'("size:5M..500M" "Big messages" ?b))
@end example
This prepend your bookmark to the list, and assign the key @key{b} to it. If
you want to @emph{append} your bookmark, you can use @code{t} as the third
argument to @code{add-to-list}.
2011-12-22 23:39:32 +01:00
In the various @t{mu4e} views, pressing @key{b} will list all the bookmarks
defined in the echo area, with the shortcut key highlight. So, to invoke your
bookmark (get the list of "Big Message", all you need to type is @kbd{bb}.
2011-12-19 08:07:03 +01:00
@node Maildir searches
@section Maildir searches
Maildir searches are quite similar to bookmark searches (see @ref{Bookmarks}),
with the difference being that the target is always a maildir -- maildir
queries provide a 'traditional' folder-like interface to a search-based e-mail
client. By default, maildir searches are available in the main view
@ref{Main view}, header view @ref{Headers view}, and message view
@ref{Message view}, with the key @kbd{j} for @code{mu4e-jump-to-maildir}.
You can do Maildir searches manually (e.g. with a query like
2011-12-22 23:39:32 +01:00
@code{maildir:/myfolder}, but since it is so common, @t{mu4e} allows for
shortcuts for this.
To enable this, you need to define a list of maildirs you'd like to have quick
access to, for example:
@example
(setq mu4e-maildir-shortcuts
'( ("/inbox" . ?i)
("/archive" . ?a)
("/lists" . ?l)
("/work" . ?w)
("/sent" . ?s))
@end example
This would set @key{i} as a shortcut for the @t{/inbox} folder; so effectively
a query @t{maildir:/inbox}. There's one 'built-in' shortcut @key{o} for
'other' (so don't use that one for your own shortcuts!), which allows you to
choose from @emph{all} maildirs.
2011-12-19 08:07:03 +01:00
Each of the folder name is relative to your top-level maildir directory; so if
you keep your maildir in @file{~/Maildir}, @file{/inbox} would refer to
@file{~/Maildir/inbox}.
2011-12-19 08:07:03 +01:00
Having these shortcuts allows you to jump around your folder very quickly -
for example, getting to the @t{/lists} folder only requires you to type
@kbd{jt}. Note that the same shortcuts are use by @code{mu4e-mark-for-move}.
2011-12-19 08:07:03 +01:00
@node Example configuration
@chapter Example configuration
@example
@verbatim
;; example configuration for mu-for-emacs (mu4e)
(require 'mu4e)
(load-library "smtpmail")
(setq
;; a regular expression that matches all email address uses by the user;
2011-12-19 08:07:03 +01:00
;; this allows us to correctly determine if user is the sender of some message
mu4e-user-mail-address-regexp
"foo@bar\.com\\|cuux@example\.com"
mu4e-maildir "/home/user/Maildir"
;; the next are relative to `mu4e-maildir'
mu4e-outbox-folder "/outbox"
mu4e-sent-folder "/sent"
mu4e-drafts-folder "/drafts"
mu4e-trash-folder "/trash"
;; the maildirs you use frequently; access them with 'j' ('jump')
mu4e-maildir-shortcuts
'( ("/archive" . ?a)
("/inbox" . ?i)
("/work" . ?w)
("/sent" . ?s))
;; program to get mail
mu4e-get-mail-command "fetchmail"
;; general emacs mail settings
mail-reply-to "foo@bar.com"
user-mail-address "foo@bar.com"
user-full-name "Foo X. Bar"
;; include in message with C-c C-w
message-signature
(concat
"Foo X. Bar\n"
"http://www.example.com\n")
;; smtp mail setting
2011-12-19 08:07:03 +01:00
message-send-mail-function 'smtpmail-send-it
smtpmail-default-smtp-server "smtpa.example.com"
smtpmail-smtp-server ""smtpa.example.com"
smtpmail-local-domain "example.com"
;; for offline mode
smtpmail-queue-mail nil
smtpmail-queue-dir "/home/user/Maildir/queue/cur")
@end verbatim
@end example
2011-12-22 23:39:32 +01:00
@node How it works
@chapter How it works
While not necessarily interesting for all users of @t{mu4e}, for some it
may be interesting to know how @t{mu4e} does its job.
@menu
* High-level overview::
* mu server::
* Reading from the server::
@end menu
@node High-level overview
@section High-level overview
On a high level, we can summarize the structure of the @t{mu4e} system using
some ascii-art:
@example
+---------+
| emacs |
| +------+
+----| mu4e | --> send mail (smtpmail)
+------+
2011-12-23 18:09:03 +01:00
| A
V | ---/ search, view, move mail
2011-12-22 23:39:32 +01:00
+---------+ \
| mu |
+---------+
| A
V |
+---------+
| Maildir | <--- receive mail (fetchmail,
+---------+ offlineimap, ...)
@end example
In words:
@itemize
@item Your e-mail messages are stored in a Maildir-directory (typically,
@file{~/Maildir}), and new mail comes in using tools like @t{fetchmail},
@t{offlineimap}, or through a local mail servers (such as @t{qmail} or
Postfix).
@item @t{mu} indexes these messages periodically, so you can quickly
search for them. @t{mu} can run in a special @t{server}-mode, where it
provides services to client software.
@item @t{mu4e}, which runs inside @t{emacs} is such a client; it
communicates with @t{mu} to search for messages, and manipulate them.
@item @t{mu4e} uses the facilities offered by @t{emacs} (the
Gnus message editor and @t{smtpmail}) to send messages.
@end itemize
@node mu server
@section @t{mu server}
@t{mu4e} is based on the @t{mu} e-mail searching/indexer. The latter is
a C-program; there are different ways to integrate with a client that is
emacs-based. One way to implement this, would be to call the @t{mu}
command-line tool with some parameters and then parse the output. In fact,
that is how some tools do it, and it was the first approach -- @t{mu4e}
would invoke e.g., @t{mu find} and process the output in emacs.
However, with approach, we need to load the entire e-mail @emph{Xapian}
database (in which the message is stored) for each invocation. Wouldn't it be
nicer to keep a running @t{mu} instance around? Indeed, it would - and
thus, the @t{mu server} sub-command was implemented. Running @t{mu
server}, you get a sort-of shell, in which you can give commands to @t{mu},
which will then spit out the results/errors. @t{mu server} is not meant for
humans, but it can be used manually, which is great for debugging.
@node Reading from the server
@section Reading from the server
In the design, the next question was what format @t{mu} should use for its
output for @t{mu4e} (@t{emacs}) to process. Some other programs use
@abbr{JSON} here, but it seemed easier (and possibly, more efficient) just to
talk to @t{emacs} in its native language: @emph{s-expressions} (to be precise:
2011-12-23 15:48:29 +01:00
@emph{plists}), and interpret those using the @t{emacs}-function
2011-12-22 23:39:32 +01:00
@code{read-from-string}.
So, now let's look how we process the data from @t{mu server} in
emacs. We'll leave out a lot of detail, @t{mu4e}-specifics, and look at a
bit more generic approach.
The first is to create a process with, for example, @code{start-process}, and
then register a filter function for it, which will be invoked whenever the
process has some chunk of output. Something like:
@verbatim
(let ((proc (start-process <arguments>)))
(set-process-filter proc 'my-process-filter)
(set-process-sentinel proc 'my-process-sentinel))
@end verbatim
2011-12-23 18:09:03 +01:00
2011-12-22 23:39:32 +01:00
Note, the process sentinel is invoked when the process is terminated -- so there
you can clean things up.
2011-12-23 18:09:03 +01:00
2011-12-22 23:39:32 +01:00
The function =my-process-filter= is a user-defined function that takes the
process and the chunk of output as arguments; in @t{mu4e} it looks something like
(pseudo-lisp):
@verbatim
(defun my-process-filter (proc str)
;; mu4e-buf: a global string variable to which data gets appended
;; as we receive it
2011-12-23 18:09:03 +01:00
(setq mu4e-buf (concat mu4e-buf str))
2011-12-22 23:39:32 +01:00
(when <we-have-received-a-full-expression>
2011-12-23 18:09:03 +01:00
<eat-expression-from mu4e-buf>
2011-12-22 23:39:32 +01:00
<evaluate-expression>))
@end verbatim
@code{<evaluate-expression>} de-multiplexes the s-expression we got. For
example, if the s-expression looks like an e-mail message header, it will be
processed by the header-handling function, which will append it to the header
list. If the s-expression looks like an error message, it will be reported to
the user. And so on.
2011-12-19 08:07:03 +01:00
@node FAQ - Frequently Anticipated Questions
@chapter FAQ - Frequently Anticipated Questions
In this chapter we list a number of anticipated questions and their answers.
@itemize
@item @emph{How can I quickly delete/move/trash a lot of messages?} You can
select ('mark' in emacs-speak) the messages, and then press one of the keys to
mark them for some actions; by default @key{DEL} for delete, @key{m} for move
and @key{t} for trash.
@item @emph{mu4e only seems to return a subset of all matches - how can I get
all?}. Yes, for speed reasons (and because, if you are like the author, you
2011-12-22 23:39:32 +01:00
usually don't need thousands of matches), @t{mu4e} returns only up to
2011-12-19 08:07:03 +01:00
@code{m4ue-search-result-limit} matches. You can customize that variable, or
2011-12-22 23:39:32 +01:00
simply press the emacs prefix @t{C-u} to get all matches. In other words,
when you press @t{C-u s hello} you will get all matches, while @t{s
2011-12-19 08:07:03 +01:00
hello} only gets you up-to-a-limited-number matches. Same for the other search
based commands, @code{mu4e-jump-to-maildir} (default: @key{j}) and
@code{mu4e-search-bookmark} (default: @key{b}).
2011-12-21 23:45:06 +01:00
@item @emph{Is there some address-book facility available?}. It should be
2011-12-22 23:39:32 +01:00
possible to use @emph{BBDB} (@inforef{bbdb}), but so far, there is no explicit
2011-12-21 23:45:06 +01:00
support. An alternative is to use
2011-12-22 23:39:32 +01:00
@t{org-contacts}@footnote{@url{http://julien.danjou.info/software/org-contacts.el}},
2011-12-21 23:45:06 +01:00
and use it with a @t{capture}-template:
@verbatim
2011-12-22 23:39:32 +01:00
("c" "contacts" entry (file "contacts.org")
2011-12-21 23:45:06 +01:00
"* %(mu4e-org-contacts-from 'name)
:PROPERTIES:
:EMAIL %(mu4e-org-contacts-from 'email)
:NICK:
:BIRTHDAY:
:END:\n\n")
@end verbatim
2011-12-19 08:07:03 +01:00
@end itemize
@node Known issues / missing features
@chapter Known issues / missing features
In this chapter we list a number of known issue and/or missing features in
2011-12-22 23:39:32 +01:00
@t{mu4e}. Thus, users won't have to search in vain for things that are not
2011-12-19 08:07:03 +01:00
there (yet), and the author can use it as a todo-list.
@itemize
@item @emph{Thread handling is incomplete.} While threads are calculated and are
visible in the headers buffer, there is no functionality to manipulate them
(e.g., collapse the thread, or delete a whole thread at once). But note that
you can manipulate a number of consequetive messages at once by selecting
them, and then using one of the manipulation commands, such as
@code{mu4e-mark-for-move} or @code{mu4e-mark-for-delete}.
@item @emph{Forwarding messaging does not forward attachments.} This is a
missing features, which will be added in some future version. Of course, you
can save attachments, and then re-attach them by hand.
@item @emph{No support for crypto when reading mail}. Currently, you cannot
conveniently read encrypted mail or check signatures (it should be possible
with e.g. EPA though, @inforef{Top, EasyPG Assistant, epa}.) For outgoing
messages, it should work though, using the built-in mechanisms.
2011-12-23 18:09:03 +01:00
@item @emph{One cannot influence the sorting of messages}. Messages are sorted
according to thread, then descending by date. It would be nice if it could be
sorted in other ways as well.
2011-12-19 08:07:03 +01:00
@item @emph{Difficulties with attachments in messages with complex
MIME-hierarchy.} While dealing with attachments usually works fine, we have
2011-12-22 23:39:32 +01:00
found some problems with specific mails. This is an issue in @t{mu}, and it is
under investigation.
@item @emph{@t{mu4e} is very much keyboard-driven}. It would be nice to add
2011-12-19 08:07:03 +01:00
support for mousing as well.
@end itemize
@bye