Qmail + Vpopmail Cheatsheet

Nick Vargish

Abstract This is a collection of answers to "how do I ..." questions for a Qmail+vpopmail mail system. Many functions can be controlled using the excellent qmailadmin Web interface, but quite a few advanced features must be handled on the command line. I also cover a few of the common operations here, just because I find the command-line a lot more efficient to use, and sometimes you just don't have access to a Web browser.


Basic vpopmail operations

The vpopmail programs are installed by default into the vpopmail user's home directory. You can link them into a directory on your path, say /usr/local/bin. Instead, you could also add ~vpopmail/bin to your path. Or you could type ~vpopmail/bin/command each time. Each approach has its advantages and disadvantages. In general, you will want to be "root" when performing any of the activities listed here.

Creating a new virtual domain

This is pretty easy:

root# vadddomain newdomain.org postmaster-password

If you leave the postmaster-password off the command line, you will be prompted to enter it interactively. It's easier just to list it on the command line, but if you do, remember that the command line might be stored in your shell's history list.

Deleting a virtual domain

Easy, but be warned, deleting a domain will delete all the users for that domain and their mailboxes. Be sure you've backed up the mailboxes or delivered the mail somewhere else if you want to preserve it. With that in mind, here's how to delete a domain:

root# vdeldomain domain.org

Adding a new virtual user

Very straightforward:

root# vadduser user@domain.org user-password

If you leave the user-password off the command line, you will be prompted for it interactively. Thus, if you're doing this from a script, you need to remember to include the password in the script.

User Manipulation

Denying POP or IMAP access to users

Not very documented, but possibly useful. If you want to control on a per-user basis who can get their e-mail via POP, it can be done. To disable POP access for a user:

root# vmoduser -p user@domain.org

To disable POP access for all users in a domain:

root# vmoduser -p domain.org

Similarly, the -i flag will prevent the user or domain from being able to access their mail through IMAP.

Re-enabling POP or IMAP access

To re-enable POP or IMAP for a user:

root# vmoduser -x user@domain.org

As with the previous command, you can make changes to all users in the virtual domain by omitting the user@ portion of the above command line. This clears all special flags for the user/domain, so if you want to enable POP but keep IMAP disabled, you would need to use the vmoduser -x command, and then re-deny IMAP access (vmoduser -i).

Quota manipulation

You can set a quota for a user when you create them by adding -q 10m (for a 10 megabyte quota) to the vadduser command line. You can set or change a quota by using the same -q quota-amount with vmoduser:

root# vmoduser -q 10m user@domain.org

As with the other vmoduser functions, you can set a quota for all users in a domain by omitting the user@ part of the command line.

Use -q NOQUOTA to disable quota checking for the given user or domain.

Redirecting mail

Creating a domain alias

A domain alias is an alias, well, for an entire domain. Create one of these if you want all mail to user@thisdomain.com to go to user@thatdomain.org, for example:

root# vaddaliasdomain thisdomain.com thatdomain.org

If you have already created thisdomain.com with vadddomain, you will need to remove it, or you will get a "domain already exists" message.

Last modified: 22 January 2003