[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Gnus does not see new mail in Maildirs

From: William G. Gardella
Subject: Re: Gnus does not see new mail in Maildirs
Date: Sat, 30 Nov 2013 00:03:22 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Emanuel Berg <> writes:

> William G. Gardella <> writes:
>> This is very close to the config I use myself and I
>> love it, so I hope this advice helps.
> I remember talking to you on gnu.emacs.gnus and I
> didn't quite understand you, and that was because your
> reasoning applied to nnmaildir, and mine to nnml.
> In the Gnus manual FAQ on different solutions for mail
> [1], I read:


> Well, that doesn't seem to be that radical a
> difference.

The main difference between Maildir and MH-style one-message-per-file
formats like nnml is that Maildir is designed to handle concurrent
manipulations by multiple clients or mail transport/mail delivery agents
at the same time.  Rather than Gnus handling final local mail delivery
to the folders where you're keeping the mail, it's possible for system
daemons to take care of that and have Gnus (and other Maildir-compatible
MUAs, mail indexing utilities, etc.) just sit back and watch. :) Your
system's mail server can be delivering mail directly to a user's Maildir
even as the user's MUA reads, moves, flags, or deletes messages in the
same Maildir.  To read more about the Maildir specification, have a look

In my setup, for example, mail arrives at my system's MTA, sendmail,
either by fetchmail from a remote POP site or by direct delivery to the
MTA.  As the final step in sendmail's processing of the incoming mail,
sendmail invokes procmail using my ~/.procmailrc, which instructs it to
deliver to several Maildirs based on information in the headers.  (Note
that some newer MTAs, e.g. Postfix, often support delivery to Maildirs
directly, so the additional local mail delivery agent like procmail may
be omittted.)

~/.procmailrc is here:

--8<---------------cut here---------------start------------->8---
:0 c
* ^X-Spam-Status: Yes
:0 Ec
* ^List-Unsubscribe:.*
:0 Ec
| notmuch new
--8<---------------cut here---------------end--------------->8---

These rules tell it to copy SpamAssassin-suspected spam to
~/Maildir/spam/, mail with a List-Unsubscribe header to
~/Maildir/lists/, and, as the fallback rule, everything else (hopefully
actual personal correspondence!) to ~/Maildir/mail/.  The final rule
runs the "notmuch" indexing software <>, which I
use together with Gnus's `nnir' library for fast search, on all the
incoming mail, and purges it from sendmail's spool.

Gnus mail-handling config in further detail is here:

--8<---------------cut here---------------start------------->8---
(setq gnus-select-method
      '(nnmaildir ""
                  (directory "~/Maildir/")
                  (get-new-mail nil)
                  (nnir-search-engine notmuch))
      '(("spam" "^X-Spam-Status: Yes")
        ("lists" "^List-Unsubscribe:.*")
        ("mail" ""))
      '((nntp ""))
      gnus-message-archive-method gnus-select-method
      gnus-message-archive-group "mail"
      nnir-notmuch-remove-prefix "/home/wgg/Maildir/"
      gnus-summary-respool-default-method 'nnmaildir)
--8<---------------cut here---------------end--------------->8---

It seems like needless redundancy, but I reproduce the procmail
splitting rules in Gnus as well so that when "respooling" mail into the
Maildir backend, e.g. from downloaded mbox archives of mailing list
posts, it is automatically filtered into the appropriate folders (even
though it didn't arrive through the sendmail->procmail pipeline).

As a subtle form of new-mail notification in the mode-line, I also use
`display-time-mode' together with an appropriate setting of

(setq display-time-mail-directory "~/Maildir/mail/new/")

`display-time' doesn't directly grok Maildir as far as I know, but the
above is a kludge so that only personal mails (those filtered to
"~/Maildir/mail"), which have not been renamed yet by Gnus or another
Maildir client (and are thus still in new/), trigger the notification.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]