Finding Your Mail
Before configuring Dovecot, you'll need to know where your mails are located. You should already have an SMTP server installed and configured to deliver mails somewhere, so the easiest way to make Dovecot work is to just use the same location.
First send a test mail to yourself:
echo "Hello me" | mail -s "Dovecot test" $USER
Now, find where the mail went. Here's a simple script which checks the most common locations:
for mbox in /var/mail/$USER /var/spool/mail/$USER ~/mbox ~/mail/* ~/*; do grep -q "Dovecot test" $mbox && echo "mbox: $mbox" done grep -q "Dovecot test" ~/Maildir/new/* 2>/dev/null && echo "Maildir: ~/Maildir"
In most installations your mail went to /var/mail/username file. This file is called INBOX in IMAP world. Since IMAP supports multiple folders, you'll also have to have a directory for them as well. Usually ~/mail is a good choice for this. For installation such as this, the mail location is specified with:
default_mail_env = mbox:~/mail:INBOX=/var/mail/%u
Where %u is replaced with the username that logs in. Similarly if your INBOX is in ~/mbox, use:
default_mail_env = mbox:~/mail:INBOX=~/mbox
Maildir exists almost always in ~/Maildir directory. The mail location is specified with:
default_mail_env = maildir:~/Maildir