# Procmail, MAILDIR



## c00kie (Apr 27, 2013)

Hi,

I wonder if you can help me with configuring Procmail. I'm following this: http://www.ii.com/internet/robots/procmail/qs/ tutorial.

I'm editing:

$HOME/.procmailrc

```
# Replace $HOME/Msgs with the directory where your personal (non-system-spool) mailboxes reside 
# Mailboxes in maildir format or served by Courier IMAP are often in $HOME/Maildir
# Mailboxes served by UW IMAP are sometimes in $HOME, sometimes in $HOME/mail, & sometimes elsewhere
# MAILDIR default is the value of $HOME
# Make sure that $MAILDIR exists and that it is a directory!

MAILDIR=$HOME/Msgs
  
# IMPORTANT:
# * On most systems $MAILDIR is a subdirectory of $HOME
# * Upon reading a line that contains MAILDIR=
#     Procmail does a chdir to $MAILDIR
#      ...and $MAILDIR becomes the Procmail working directory
#       ...and relative paths are relative to $MAILDIR
# * Do not include a trailing slash in your MAILDIR setting
# * The $MAILDIR directory must exist and must be writable by your LOGNAME
# * The MAILDIR variable is an entirely different entity from maildir mailbox format
     
#### End Variables Section; Begin Processing Section ####
```

It's these lines that I'm unsure about:


```
Make sure you replace  MAILDIR=$HOME/Msgs  with the directory where your personal (non-system-spool) mailboxes are stored and that this directory exists and is writable by your LOGNAME. The MAILDIR variable specifies Procmail's working directory and all relative paths are relative to this directory.
```


I*'*ve created a $HOME/Msgs directory and set 
	
	



```
MAILDIR=$HOME/Msgs
```
 Is this the correct path? Only I'm a little unsure. If I'm logged in as 'me' say, I thought my personal (non-system-spool) mailboxes would reside in: 

`$ cd /var/mail`
`$ ls`

```
me	admin	ftp	mysql	root	tqadmin	www
```

So should 
	
	



```
MAILDIR=/var/mail
```
 or the former?


----------



## wblock@ (Apr 27, 2013)

It would be your user's local mail directory.  For user me, that would typically be /home/me/mail.

Incidentally, procmail is very old and not well-maintained.  mail/maildrop is newer and easier to use.  I have an article on it: Switching From procmail To maildrop.


----------



## ondra_knezour (Apr 27, 2013)

As I understand it, MAILDIR for user *me* will be /var/mail/me, depends on your MTA settings.

If you use mail/dovecot2, you can also utilize Dovecot LDA, which can process Sieve rules.


----------



## c00kie (Apr 27, 2013)

wblock@ said:
			
		

> It would be your user's local mail directory.  For user me, that would typically be /home/me/mail.



And if /home/me/mail didn't exist, one would simply create it?


----------



## kpa (Apr 27, 2013)

I believe you can automate the creation of the /home/me/mail directory (or /home/me/Mail, some mail user agents default to Mail with a capital m) with mail/maildrop.


----------



## wblock@ (Apr 27, 2013)

Backing up: there are two directories involved.  Users will have a directory in /var/mail where "system spooled" mail is kept, their "inbox".  maildrop or procmail can filter incoming mail into other directories, and these will be in the user's home directory.

Your MUA may create a mail directory automatically.  If not, creating it on your own should be fine.  Set the permissions to 700 to keep others from reading your mail.


----------

