Setting up test user email accounts on a domU

by jenny on 30 October 2007 - 05:03am in

Replace domU below with the hostname of your virtual machine and username with your personal user account.

On domU

Install a mail transfer agent and imap server

sudo apt-get install postfix dovecot

Set up postfix

Create a /etc/postfix/virtual file with entries like so:

@domU username@domU
@localhost username@domU

Generate the virtual.db:

postmap /etc/postfix/virtual

Tell postfix about your new virtual setup by adding the following to /etc/postfix/main.cf:

virtual_alias_maps = hash:/etc/postfix/virtual
virtual_alias_domains = domU, localhost

Restart postfix:

/etc/init.d/postfix restart

Set up dovecot

In /etc/dovecot/dovecot.conf, find this line:

#protocols = imap imaps

Change it to:
protocols = imap

Restart dovecot:
sudo /etc/init.d/dovecot restart

On dom0

Set up a new account in your favorite mail reader:

  • Protocol: IMAP
  • Host: domU
  • User: username

You will now receive all mails to foo@domU, bar@domU, etc.