Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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:

:0:
* ^TO_myemailaddress@domain.com
Xyz

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
add comment

1 Answer

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.

MAILDIR="$HOME/Maildir/"

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

:0:
* ^TO_myemailaddress@domain.com
Xyz/

This is one of my favorite procmail references. 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
add comment

Your Answer

 
discard

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.