Ano-Tech Computers
Enter keyword:

Setting up Qmail virtualhosting with multiple recepiants
Problem:
This article describes how to set up a virtualhost with qmail to distribute mail for that domain to multiple user accounts.
 
Solution:
1. Add domain to /var/qmail/control/rcpthosts
2. Add domain:user-domainhandle to /var/qmail/control/virtualdomains, e.g.
"exampledomain.org:johndoe-example"
3. "su -" to the admin user for that domain, in this case "johndoe"
4. Create a ".qmail-default" file pointing to the default recepiant (see below)
5. Create a ".qmail-domainhandle-recepiant" file for each recepiant:

* ".qmail-example-johndoe" will control mail for "johndoe@exampledomain.org"
* ".qmail-example-janedoe" will control mail for "janedoe@exampledomain.org"
* ".qmail-example-john:doe" will control mail for "john.doe@exampledomain.org"
* ".qmail-example-default" will control all other mail for exampledomain.org.

Each file may contain one or more recepients for each .qmail file:

* "&john" will cause delivery to a local user called "john"
* "john" will cause delivery to a local user called "john" (i.e the leading ampersand is optional)
* "john@otherdomain.org" will cause delivery to a remote mail exchange
* "| /full/path/to/program" will cause execution of that program, which will receive the full email through STDIN
* "# comment" is a comment (no duh! ;-)
* "/full/path/to/Maildir/" will cause delivery to a locally stored mail DIRECTORY (The trailing slash is important)
* "/full/path/to/Mailbox" will cause delivery to a locally stored mailbox

Finally, reload qmail to activate changes:
/etc/rc.d/init.d/qmail reload

For more information about how to write proper .qmail files: "man dot-qmail"
 
Discuss this solution
Did this article solve your problem? Yes No Did not apply

We welcome anyone who is willing to contribute to this public knowledge base, contact siteadmin@atc.no if you have information you would like to share. The idea is not to replace the commercial support sites, but to publish those hard-to-find solutions you've found yourself looking for over and over again.

Show all articles