Virtual domain email aliases HOWTO for sme server

Release applicable: sme server v6.0, 6.0.1, see note re sme v7.0

Author: Ray Mitchell mitchellcpa_AT_yahoo.com.au

Original author: Darrell May

Contributor: Gordon Rowell

Revision date: 1 April, 2006 v1.3

Note re sme v7.0 - This feature has been incorporated into sme server v7.0 using the Pseudonyms panel. Email addresses in the form of user1@domain1 and user1@domain2 can be entered and forwarded to seperate end user accounts. This HOWTO is not applicable to sme 7.0.

Problem:
You need to set-up virtual email domains that support for example
info@domain1.com and forward this e-mail to the appropriate recipient. For our example will send info@domain1.com to the user fred.

You also want certain email addresses to only be valid for certain domains.

Solution:
Follow the steps below to create email aliases.

Additionally, install the following rpm to control which email addresses are valid for which domains. It will add a server manager panel to allow easy configuration. Note that installing this rpm will cause all emails sent to invalid addresses to be rejected. You can also configure email rules using this contrib.

To completely manage virtual domain email you will need to use both the email aliases custom template and the mailblocking rpm.

Download from http://www.dungog.net/sme/files/index.php

or

http://distro.ibiblio.org/pub/linux/distributions/smeserver//contribs/dungog/packages/smeserver/

For sme 6.0, 6.0.1

dungog-mailblocking-1.0-4.noarch.rpm

For sme 6.5

dungog-mailblocking-1.1-2.noarch.rpm

Install with rpm -Uvh dungog-mailblocking*.rpm

 

 

Step 1- Virtual Domain Set-up:

Use the e-smith-manager, Configuration/Domains panel to set-up the virtual domain, domain1.com. Instructions are found in the user manual.

Step 2 - Create your user:

Use the e-smith-manager, User accounts panel to set-up the user fred. Instructions are found in the user manual.

Step 3 - Create a templates-custom fragment:
	mkdir -p /etc/e-smith/templates-custom/var/qmail/control/virtualdomains
	pico /etc/e-smith/templates-custom/var/qmail/control/virtualdomains/90aliases

In this 90aliases file enter all your virtual aliases in the form alias:username. In the example below info@domain1.com is to go to user fred.

	info@domain1.com:fred

If you want all domain mail going into one account, enter your virtual alias in the form domain:username. In the example below domain1.com:fred sends all @domain1.com mail to user fred.

	domain1.com:fred

If you want all domain mail going into one account, except for defined users, enter your virtual aliases in the form shown below. In the example below domain1.com:fred sends all @domain1.com mail to user fred except for jim and bob who get their mail directly..

	domain1.com:fred
	jim@domain1.com:jim
	bob@domain1.com:bob

Step 4 - Save the file above and execute a email-update:

	/sbin/e-smith/signal-event email-update

This recreates the file var/qmail/control/virtualdomains with the above alias entries preceeding the domain entries and restarts qmail.

Step 5 - Test the above virtual aliases:

Send an e-mail to info@domain1.com to test that it is received by the qmail server without error and reach the intended recipient (fred) mailbox.


Should readers of this HOWTO wish to configure email aliases on earlier versions of sme server, they need to do the following steps as well (in the correct sequence) or alternatively refer to earlier versions of this HOWTO by Darrell May

Step 2a - Create users .qmail-default: (not required in v6.0 sme server)

In the users home directory, /home/e-smith/files/users/fred create a file named .qmail-default containing only one line, the users name, fred.

	pico /home/e-smith/files/users/fred/.qmail-default
	- add the one word fred
	- save the file

Step 2b - Set the ownership and rights on .qmail-default to the user only: (not required in v6.0 sme server)

	chown fred:fred /home/e-smith/files/users/fred/.qmail-default

chmod 644 /home/e-smith/files/users/fred/.qmail-default