An overview
On this tutorial we'll walk you trough a few things that are always good to know when managing a mail server, mainly:- what are the basic management commands
- where are the important directories
- where the log files are stored
Dovecot directories and files
User directory structure
Every user has a directory inside the domain directory (es. lorenzo@example.com will be found on /var/vmail/example.com/lorenzo/), inside this directory there are quite a lot of hidden files and it's good to know their purpose, let's look at the directory tree:/var/vmail/example.com/lorenzo/
|___.dovecot.sieve -> Maildir/sieve/roundcube.sieve
|___.dovecot.svbin
|___Maildir
|___cur
|___new
|___tmp
|___.SentThis is a symbolic link to the file with the sieve rules generated by the roundcube plugin.
- .dovecot.svbin
This is the compiled version of the .dovecot.sieve file, Sieve rules needs to be compiled, this happens automatically the first time that the sieve script is executed. If you ever need to set more elaborate rules you can write them manually on the .dovecot.sieve file and remember to remove the compiled version. Be careful that Roundcube will attempt to overwrite your change when saving a new set of rules.
- Maildir
This is the main Maildir directory where all the messages are stored, it contains three main directories and all the IMAP subfolders as hidden directories
- cur
This is the INBOX folder containing all the messages already seen by the user's mail client.
- new
This is the INBOX folder containing all the messages already to be seen (or downloaded for POP3) by the user's mail client.
- tmp
This directory contains mail that are in the process of being delivered to the user.
Additional folders that the user (or his mail application) could be creating are "hidden", their name begin with a period: such as .Drafts or .Sent.
Each folder itself contains the same three subdirectories, tmp, new, and cur, and an additional zero-length file named maildirfolder, whose purpose is to inform any mail delivery agent that it's really delivering to a folder, and that the mail delivery agent should look in the parent directory for any maildir-related information.
Folders are not physically nested. A folder subdirectory, such as .Sent does not itself contain any subfolders. The main maildir contains a single, flat list of subfolders. These folders are logically nested, and periods serve to separate folder hierarchies. For example, .Sent.2002 is considered to be a subfolder called "2002" which is a subfolder of "Sent".
Files timestamp
Filesystem date on files in the mail folder (/var/vmail) are important and used by the imap server (dovecot) to check the e-mails date so when doing rsync, scp, etc be sure to copy all the metadata of this files. For example be sure to use:rsync -aLog files
/var/log/mail.logThis file contains all the postfix logs with the connections to the SMTP and the spam check informations.
/var/log/mail.err
This file contains all the postfix server errors, it should usually be empty.
/var/vmail/dovecot-deliver.log
This file contains all the dovecot logs for the stored mail, you should see the Sieve filtering in action and the status of every mail received by dovecot.
Postfix commands
postqueue
The postqueue command allow the administrator to view and manage the postfix mail queue but does not allow to delete message or change it's status, here are listed the main options:postqueue -p* The message is in the active queue, i.e. the message is selected for delivery.
! The message is in the hold queue, i.e. no further delivery attempt will be made until the mail is taken off hold.
postqueue -fpostsuper
This command enable the superuser to do maintenance jobs on the Postfix queue. This command should be used with extreme care since it's very easy to mess something up and delete all the mails in the queue.postsuper -d queue_idpostsuper -h queue_idpostsuper -H queue_idpostcat
This command prints the content of a mail in a human-readable form. You should pass as a parameter the filename of the mail message.- Log in to post comments