Exim and ISPmanager

From ISPWiki

Jump to: navigation, search


General information about Exim

The exim directory:

Linux - /etc/exim4

FreeBSD - /usr/local/etc/exim

Main files:

configure (or exim4.conf.template on Linux) - configuration file

aliases - list of mail aliases

domains - e-mail domains

passwd - mailboxes



Creating e-mail domains through ISPmanager

Module «Exim and ISPmanager»

The information about an e-mail domain is specified in the domains file. The file may vary depending on the "Default actions" field.

Let's take company.me as an example.

- Selecting "Reply error" in the "Default action" field will add the following record into the "domains" file:


- "Ignore and drop":


- "Redirect to email address" (redirect to mary@me.ru):


In the domainips file you specify the IP address from which email messages will be sent.


Creating mailboxes through ISPmanager


The information about mailboxes is kept in the passwd file

Let's take mary@company.me as an example. The following record will be specified in passwd:


where: 1000 - UID of the mailbox's owner

1004 - GID of the mailbox's owner

0 - size of the mailbox (0 - unlimited).

/home/fly/data/email/company.me/mary/mail - path to the mailbox home directory

I5hyC6SA - password to access the mailbox

The mailbox password can be kept in the passwd file or in the sasdb base, depending on the Exim settings. If you want to know if Exim is using sasldb or passwd, locate the begin authenticators section in the Exim configuration file

driver = plaintext 
public_name = LOGIN 
server_prompts = "Username:: : Password::" 
server_condition = ${if and{{!eq{$2}{}} {eq {$2} {${extract {6} {:} {${lookup{$1}lsearch{/usr/local/etc/exim/passwd}}}}}}} {yes} {no} } 
server_set_id = $1 

From the example above we can see that the passwords are kept in the passwd file.

The mailbox aliases and addresses for redirection are specified in the aliases file.

For example, we can use the alias "garry" for the mary@company.me mailbox. The aliases file will contain the following record:


Redirect email messages to mail@gmail.com, and the following record will be added into the aliases file:


Selecting the check box "Don't save incoming e-mails" will addd the following record:


The following record will be created in the aliases file while creating a user in ISPmanager:


This will enable users to send emails from console and scripts. For example, executing the mail <mailbox> command from the console will send the message from the mailbox specified above. If the mailbox does not exists, the email won't pass verification and won't be sent.


When adding an auto-responder, the /<mailbox directory>/vacation/message.txt file containing a response text will be created.

If the auto-responder fails, locate the possible cause in the email server's logs. A possible cause maight be incorrect privileges on message.txt

maildir and mbox storage formats

maildir is a way of storing incoming email messages. The Maildir directory usually has three subdirectories named tmp, new, and cur. Each message is stored in a separate file with a unique name. Each file in the new directory is a new email message. The file modification time corresponds to the email delivery time. The tmp directory is used to deliver email messages. First the message is specified in the file in the tmp directory and then it is moved into the new directory. Read email messages are kept in the cur directory.

mbox stores all messages in one file.

How can I learn the format used by your email server?

Locate the local_delivery in the Exim configuration file:

file = ${extract{4}{:}{${lookup{$local_part@$domain}lsearch{/usr/local/etc/exim/passwd}}}}/mbox indicates that mbox is used

driver = appendfile 
maildir_format = true 
maildir_use_size_file = true 
create_directory = true 
directory_mode = 700 
directory = ${extract{4}{:}{${lookup{$local_part@$domain}lsearch{/usr/local/etc/exim/passwd}}}}/.maildir 

indicates that maildir is used.

If you are running Procmail, and the procmailrc file is locates in the mailbox directory, the section is not used. In this case Procmail send messages to a mailbox, so you should check /usr/local/etc/procmailrc (or /etc/procmailrc on Linux) to locate the place where email messages are kept.

Calculating mailbox quota

If you are running Maildir, the eximquota process checks that the mailbox size does not exceed the maximum allowed amount.

If you are running Procmail, eximquota checks the size of the maildir directory.

If you are running Maildrop, eximquota uses the maildirsize file. The maildirsize updates Maildrop when receiving a new email message. The file contains both the quota limit information and the current quota status.

If you are running mbox, Exim will calculate quotas itself.

Moving a mailbox between user accounts

Checked on Debian 6, exim4-4.72-6+squeeze3

We will move the m.fvds.ru email domain(the mary@m.fvds.ru mailbox) from mary to volt

Locate the home directory of the email domain:

# cat /etc/exim4/passwd

Move it into the home directory of the new user

mv /var/www/mary/data/email/m.fvds.ru/ /var/www/volt/data/email/m.fvds.ru/

Change the owner

chown -R volt:volt /var/www/volt/data/email

In /etc/exim4/passwd change GID and UID, provide information about the new user and the new directory.

In the dovecot configuration file (/etc/dovecot/dovecot.passwd) change the mailbox directory, UID, and GID.

In the ISPmanager configuration file (/usr/local/ispmgr/etc/ispmgr.conf) locate Domain m.fvds.ru 514 and change 514 into the UID of the new user.

Restart ISPmanager

killall ispmgr

Restart exim

/etc/init.d/exim4 restart

Restart dovecot

/etc/init.d/dovecot restart


Q: How to change the storage format from mbox into maildir

А: Edit the following line in the Exim configuration file

file = ${extract{4}{:}{${lookup{$local_part@$domain}lsearch{/usr/local/etc/exim/passwd}}}}/mbox


directory = ${extract{4}{:}{${lookup{$local_part@$domain}lsearch{/usr/local/etc/exim/passwd}}}}/.maildir 

add the followings into the local_delivery section

maildir_format = true 
maildir_use_size_file = true 
create_directory = true 
directory_mode = 700 

If you are running Procmail, change mbox into maildir in /usr/local/etc/procmailrc (or /etc/procmailrc on Linux)

You should also change mbox into maildir in dovecot.passwd

Q: Where does ISPmanager take a list of mailboxes from?

A: It takes it from /usr/local/etc/dovecot.passwd (/etc/dovecot.passwd on Linux)

Q: eximquota often "fails", what should I do?

А: In the Exim configuration file change {exists{/usr/local/ispmgr/var/eximquota.sock}}\ into {exists{/usr/local/ispmgr/var/eximquota.pid}}\ to make Exim check the process by pid, rather then by socket.

Was this helpful? Yes | No
Personal tools