Aug 03

exim - add email addresses or mail users

Category: Linux,webserver   — Published by goeszen on August 3, 2015 at 9:45 am

So you want to add more email addresses or email users to a system running exim? Here's how:

Make sure an alias is defined
How do you "add" users to your exim configuration, so mail sent to one of your domains hosted on this machine is properly delivered to the user's inbox? Well, first you need to create the user as a local user on that machine. If you want to define an alias for an already created user, you need to add an alias for a local user in the /etc/aliases file. This is where the system looks for local delivery of mail in case there's email for a user not existing on the system.

Make sure exim is accepting email
Make sure exim is accepting email for a domain hosted on the local system or is accepting mail for a host from your domain. Try sending an email to an address you are creating and tail the exim4 logfile like so:

$ tail /var/log/exim4/mainlog -F

Adding your host to the hostlist
If you see exim reporting "rejected RCPT : relay not permitted", then you need to add the domain the email is from to the list of handled hosts. Look for the exim config file /etc/exim4/exim4.conf and add the domain after "hostlist relay_from_hosts =". If the /etc/exim4/exim4.conf file is not there, you have exim configured to use Debian-style split config files (see below)

(After this manual config change, you need to do $ /etc/init.d/exim4 restart)

where is exim's conf file?
It usually is in /etc/exim4/exim4.conf - if you have it configured to use one monolithic config file. On Debian, you usually use split config files, which are administered by calling $ dpkg-reconfigure exim4-config

Modify the hostlist via dpkg-reconfigure
If the exim conf file is not in /etc, it seems exim is configured with split config files - which in turn are usually modified only by calling $ dpkg-reconfigure exim4-config
This CLI wizard will ask you about the host's IP and for which domains your system should act as a relay (meaning "delivering emails to a local email account/ email mailbox" here)

After you've exited the wizard, dpkg-reconfigure will restart exim for you.

For reference: exim docs

Leave a Reply