Virtual mail domains and users in plain files

Table of Contents

Introduction
Configuration
Usage

Introduction

by ross at 11:07:11 on April 27, 2017

Simple setup of Exim uses system users (/etc/master.passwd & /etc/passwd) and one domain to receive mail.

If you need more then one mail domain and you also do not want mail users in your system master.passwd you need a virtual mail domains/users support. Some people do this by storing all the data in a SQL database. This setup however is using plain files only.

We have two directories: /etc/mail/virtual (configuration) and /home/mail (actual mailboxes).

Files in /etc/mail/virtual are:

  • exim.filter — system Exim filter
  • exim.domain2mx — maps our domains to official host names
  • exim.domain2ip — maps our domains to IP addresses/system host names where Exim is listening
  • exim.ip2mx — maps our ip addresses to official host names)

Every directory in /etc/mail/virtual is a domain, i.e. /etc/mail/virtual/example.com defines virtual domain example.com.

Every domain directory will have these files:

  • master.passwd
  • passwd
  • aliases
  • quota

Data of virtual users is kept under /home/mail/$domain/$user, i.e. mail of user alice of example.com will be here: /home/mail/example.com/alice.

This user directory will have:

  • Maildir subdirectory — where all the mail is kept in maildir format
  • filter file — personal Exim filter.

This is all you need to arganize virtual mail domains. A simple utility for managing password files is provided - eximpw.

 

Comments