Search code examples
procmailmu4e

procmail does not save emails in maildir/new


Procmail saves all new emails directly at the desired maildir folder instead of the maildir/new. My .procmailrc is the following:

SHELL=/bin/bash
LINEBUF=4096
PATH=/bin:/usr/bin:/usr/local/bin:/opt/local/bin
VERBOSE=off
MAILDIR=/mnt/data/maildir
DEFAULT=$MAILDIR/inbox/ # See the slash!
LOGFILE=$HOME/procmaillog
FORMAIL=/opt/local/bin/formail
SENDMAIL=/usr/sbin/sendmail

# Nuke duplicate messages
:0 Wh: msgid.lock
| $FORMAIL -D 8192 msgid.cache
:0 a: 
$MAILDIR/duplicates

# SpamAssassin sample procmailrc
:0fw: spamassassin.lock
* < 256000
| spamassassin-5.24 

# Mails with a score of 15 or higher are almost certainly spam (with 0.05%
# false positives according to rules/STATISTICS.txt). Let's put them in a
# different mbox. (This one is optional.)
:0:
* ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
$MAILDIR/junk

# All mail tagged as spam (eg. with a score higher than the set threshold)
:0:
* ^X-Spam-Status: Yes
$MAILDIR/junk

:0:
* ^List-id: .*(somelist_id|someother_list_id|etc)
$MAILDIR/nerdy_groups_and_lists

# Work around procmail bug: any output on stderr will cause the "F" in "From"
# to be dropped.  This will re-add it.
:0
* ^^rom[ ]
{
  LOG="*** Dropped F off From_ header! Fixing up. "
  :0 fhw
  | sed -e '1s/^/F/'
}

the problem is that instead of finding my emails under e.g. /mnt/data/maildir/junk/new or /mnt/data/maildir/nerdy_groups_and_lists/new I find them under /mnt/data/maildir/junk and /mnt/data/maildir/nerdy_groups_and_lists, respectively and mu4e cannot find them. What am I doing wrong?


Solution

  • The syntax to deliver into a maildir folder requires a significant trailing slash on the directory name. Without the slash, as you have discovered, Procmail writes in an older legacy format which creates monotonically numbered files in the directory itself. (There is also an MH mode which creates files using MH conventions, which uses dir/. with a slash and a dot.)