# Using procmail or forward with mdbox

Due to the way email is delivered in the school, if you choose to use mdbox or maildir, you will need to take special care with .forward or .procmailrc configurations.  The advanced mailbox formats require that dovecot (the imap server) be responsible for final delivery.  This means that your configurations must be aware of dovecot.

## .forward

For .forward that means using an #Exim filer command at the beginning of your .forward.

#Exim filter

unseen deliver forwardedaddress@gmail.com

This will cause the message to be delivered to forwardedaddress@gmail.com and also retain a copy locally.

## .procmailrc

To ensure that your mail is delivered via dovecot, you need to make the final destination a pipe to the deliver program.  The example below filters messages from priya into the Priya folder and delivers the remainder to the Inbox.

DELIVER="/usr/bin/deliver"
LOGFILE="$HOME/.procmail.log" :0 * ^From priya@* |$DELIVER -d $LOGNAME -m Priya :0 w |$DELIVER -d \$LOGNAME

If you do not use the deliver command and allow procmail to deliver the message, it will deliver it to a file in your home directory which you cannot access from the IMAP server.  If this does happen, you can use imap_upload to transfer the message into your IMAP message store.