Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I installed Getmail to retrieve emails from another email server and Procmail to filter the incoming emails. (I am running Debian/Squeeze.)

The recipe I created has this code:

* ^TO_myemailaddress@domain.com

I thought this will make sure that all incoming emails will be saved in ~/Maildir/Xyz/ as individual files. Instead, it seems to be creating a file called Xyz (not a directory) inside ~/Maildir/ and appending new emails to the same file.

How do I save incoming mails as individual files to a folder, instead of a single file?

share|improve this question
up vote 2 down vote accepted

The top level of procmail recipes are reserved for assignment of procmail variables. Add the following to the top of your procmail recipe.


When defining where the mail should be delivered, you have defined Xyz as a file, not a directory. It should instead read:

* ^TO_myemailaddress@domain.com

This is one of my favorite. procmail is extremely powerful with many options. I'm always amazed at what it can do.

share|improve this answer
That worked perfectly! Thank you. (I had set MAILDIR=$HOME/Maildir/ earlier, but wasn't sure if I should add the forward slash at the of the folder name.) – Spartanblogger Jan 25 '13 at 18:16
And thank you for the reference guide! – Spartanblogger Jan 25 '13 at 18:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.