Understanding mail at Pair Networks

How mail works at Pair Networks.

THE BASICS
Pair Networks uses FreeBSD, IMAP, mbox, and Dovecot.

Update: This knowledge base article states in part:

For QS, VQS, and accounts created prior to June 1, 2011, we include a symbolic link in your Home directory called “boxes” that points to /usr/boxes/USERNAME. This directory is where all the e-mail for your virtual mailboxes is stored.

Accounts created after June 1, 2011 must access all e-mail using IMAP or POP, and do not have direct file access to mailbox files.

FILE STRUCTURE
The file structure is best illustrated with a simple example. Consider the hosting account verdi, which has two domains associated with it, aida.com and latraviata.com. The former domain has no mailboxes, and the latter has one, violetta. Aside from the system generated folders, user violetta has created three folders of her own such that in her IMAP client she sees:

Inbox
Drafts
Sent
Spam
Trash
Alfredo     User-created folder
Clients/    User-created folder
  Douphol   User-created folder

Depending on her IMAP client, the generated folders may read (for example) INBOX.Drafts instead of Drafts, or Junk instead of Spam.

A user-created folder can contain either mail or nested folders but not both. Thus in the example above, the folder Clients cannot directly contain mail because it contains the nested folder Douphol.

We would thus have the file structure:

/usr/boxes/verdi/       Mail root for user verdi
  bayes/                SpamAssassin-generated stuff
  latraviata.com/       1 directory for each domain
    violetta            File (not directory) for inbox
    violetta^/          Directory to hold folders
      .imap/
        .imap/          Dovecot-generated index
        .mailboxlist    IMAP client-generated stuff
        .subscriptions  IMAP client-generated stuff
        INBOX.Drafts    IMAP client-generated file for drafts
        INBOX.Sent      IMAP client-generated file for sent messages
        INBOX.Spam      IMAP client-generated file for spam
        INBOX.Trash     IMAP client-generated file for trash
        Alfredo         User-created file
        Clients/        User-created directory to hold nested folders
          .imap/        Dovecot-generated index
          Douphol       User-created file

Generated directories and files are created as needed, so not every setup has everything illustrated here.

The exact names of the IMAP client-generated files vary. For example, RoundCube uses INBOX.Junk rather than INBOX.Spam by default. This behavior can be changed in RoundCube’s configuration, or you can make INBOX.Junk a symbolic link to INBOX.Spam.

Notice that the mail root is outside the hosting account root, which following our example would be /usr/home/verdi/. To make administration easier, I like to make the symbolic link /usr/home/verdi/boxes which points to /usr/boxes/verdi/.

THE CATCH-ALL MAILBOX
Outside the file structure described above is the catch-all mailbox associated with the hosting account. If enabled, the catch-all receives mail addressed to nonexistent mailboxes in associated domains. Following our example above, the mailbox radames@aida.com does not exist. Incoming mail addressed to radames@aida.com would be delivered to the catch-all if enabled, and would be rejected by the system if the catch-all were not enabled.

Usually all the catch-all catches is spam, so Pair Networks recommends that the catch-all be disabled. Disabling it does not discard its contents; you’ll have to do that manually — something you’ll want to do, given that it counts against your disk quota and may well be very large. The catch-all is the file /var/mail/ACCOUNTNAME and only exists if it has received incoming mail. Following our example above, it would be the file /var/mail/verdi. Delete it (if it exists) using SSH or FTP.

CHECKING SPACE USED WITH SSH
The following is for administrators. End users will find the first part of “Checking mailbox quotas and space used” more useful.

Let’s begin in the mail root:

% cd /usr/boxes/verdi/
/usr/boxes/verdi

To see space used per domain name:

% du -chd 0 *
122K    bayes
 52M    aida.com
 61M    latraviata.com
113M    total

Let’s enter a directory corresponding to a domain name and see space used per mailbox:

% cd latraviata.com/
/usr/boxes/verdi/latraviata.com
% du -chd 0 *
 13M    gastone
 24M    gastone^
 17M    violetta
 10M    violetta^
 64M    total

Each mailbox’s inbox is listed first (e.g. violetta), followed by a directory containing the rest of the mailbox (e.g. violetta^). The total size of each mailbox is not shown here; you must add the inbox and directory sizes (e.g. the the total size of mailbox violetta is 17+10=27M).

Too lazy to add in your head? To see the total size of a single mailbox:

% du -chd 0 violetta*
 17M    violetta
 10M    violetta^
 27M    total

The trailing asterisk is needed to show usage for both the inbox (first entry, without the caret) and the directory holding the rest of the mailbox (second entry, with the caret). The recursion depth of 0 hides the other folders in the mailbox; to see them, increase the recursion depth as needed:

% du -chd 4 violetta*
 17M    violetta
 86K    violetta^/.imap/.imap/INBOX
 24K    violetta^/.imap/.imap/INBOX.Drafts
 54K    violetta^/.imap/.imap/INBOX.Sent
 44K    violetta^/.imap/.imap/INBOX.Spam
 82K    violetta^/.imap/.imap/INBOX.Trash
  7M    violetta^/.imap/.imap/Alfredo
  3M  	violetta^/.imap/Clients/.imap/Douphol
326K  	violetta^/.imap/Clients/.imap
 10M  	violetta^/.imap/Clients
 10M    violetta^/.imap
 10M    violetta^
 27M    total

Sizes do not appear to add up because sizes are reported for all subdirectories. Dovecot-generated indexes are not counted against the disk quota of your account.

REFERENCES
File directory structure at Pair Networks
Stopping junk mail at Pair Networks

Advertisements

About Warren Post

So far: Customer support guy, jungle guide, IT consultant, beach bum, entrepreneur, teacher, diplomat, over-enthusiastic cyclist. Tomorrow: who knows?
This entry was posted in Uncategorized and tagged , , , . Bookmark the permalink.

3 Responses to Understanding mail at Pair Networks

  1. anonymous says:

    Matt R writes:Just a note: the Dovecot generated indexes (the .imap/.imap stuff) are not counted against the disk quota of your account.

  2. wpost says:

    Thanks; that's good to know.

  3. Pingback: Checking mailbox quotas and space used | A maze of twisty little passages

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s