Finally the help of IT is here

Blog of computer solutions.

Mail server installation EXIM4

Written by Pablo Gonzalez on July 3rd, 2012

Good afternoon, in this article we will see how to make Mail server installation EXIM4 with a dynamic IP address.

Personally, I do not recommend this configuration because we have serious problems blocking blacklist, so, this article has only academic value. To inspire the reader to other servers and services.

We start from an installation of GNU / Debian default 6 in an old notebook.

Add repositories / Etc / apt / sources.list

deb squeeze main contrib non-free
deb-src squeeze main contrib non-free

rename with # the line that begins with deb cdrom.

We enter the following command with the username root:

aptitude update (With this update we have added the repositories above).

Install the no-ip client, since I have dynamic ip address and in many cases (the vast majority) must match the domain to your ip when mail is delivered, otherwise, the target server will consider it as spam. I assume that you generate a suitable account if necessary.

We can decompress with xvzf tar noip-duc-linux.tar.gz and we will create a folder.

We continue with the following commands:

cd-2.1.9-1 noip

make install noip2.c

We requested email address, password and the update interval, which in my case I have considered going down to 5. We also ask if you want to run any programs in each update, and in my case I select No.

We generated the configuration file non-ip2.conf.

Run from the command line noip2. We will have to run every time we restart our Debian.

We must install gcc and make for no-ip client and run it as an administrator:

apt-get install gcc make

apt-get install-daemon-heavy exim4 (Indicating that the installation is complete started exim4)

apt-get install-config exim4 (This package is also required to set, however the previous install should already be installed).

dpkg-reconfigure-plow-config exim4


Internet site and press to accept.


System Name: I; localhost and press to accept.


We erase what gives us by default (; :: 1) And press OK. Thus we hear all interfaces.

We retain the value that offers: I and press OK.

We wrote "*" "Domains for which mail is forwarded" and press OK.

In "Machines for which forward mail, we wrote; / 24"And press OK.


select DO NOT en limit the number of DNS queries.

Select the format maildir and press OK.


select DO NOT en divide the configuration into small files.

Here how I attached the configuration file of Exim mail server is in / Etc / exim4 / update-exim4.conf.conf

You can adapt it to your needs and then run update-exim4.

dc_eximconfig_configtype = 'internet'
dc_other_hostnames = 'I; localhost '
dc_local_interfaces = ''
dc_readhost =''
dc_relay_domains = '*'
dc_minimaldns = 'false'
dc_relay_nets = '; / 24'
dc_smarthost =''
dc_use_split_config = 'false'
dc_hide_mailname =''
dc_mailname_in_oh = 'true'
dc_localdelivery = 'maildir_home'

verify / Etc / mailname contains the I set.

We found that after configuring the system informs us that MTA and started without errors.

We created a Debian user, for example, megacrack

useradd-d / home / megacrack-m megacrack

passwd megacrack

We found that no errors with these commands:


bt exim-v-user (Where username is the name of an appropriate user, could be the previously created user "megacrack").

And it shows the user's own information, the style [Email protected].

Run the command:

echo "test" | mail-s "test" megacrack | cat / var / log / exim4 / mainlog

Edit file / Etc / hosts and add or modify the line: server

the correct internal ip of the server (in my case

We perform an upgrade, through:

apt-get update

Install using the command:

apt-get install courier-imap

Failure to install read errors we post.

We see a configuration window and answer DO NOT the question of creating directories for web-based administration.

Reboot the server to apply changes.

Now we can read emails via imap.

Now configure authentication for SMTP (For many mail systems is necessary because we may be detected as spam. A part is a security system).

Generate the SSL certificate by:

/ Usr / share / doc / exim4-base / examples / exim-gencert

And we respond:







[Email protected]

It has generated our certificate ...

Edit the file / Etc / exim4 / conf.d / auth / 30_exim4-config_examples and we show the lines as follows:

driver = plaintext
public_name = PLAIN
server_condition = "$ {if
server_set_id = $ auth2
server_prompts =:
server_advertise_condition = $ {if eq {$ tls_cipher} {} {} {*}}
. Endif

Edit your / etc / exim4 / conf.d / main / 01_exim4-config_listmacrosdefs and write in the first line: MAIN_TLS_ENABLE = true.
Create the file / etc / exim4 / conf.d / main / 02_local_auth_advertise_hosts with the contents:

auth_advertise_hosts =! / 24
host_auth_accept_relay = * hostlist

Add the user using the command megacrack / Usr / share / doc / exim4 / examples / exim-adduser . We requested username "megacrack" and password.

If we see the contents of the file / Etc / exim4 / passwd see the user's password. This point will solve it in another article with another type of authentication.

Change ownership and permissions (in principle, permits and are correct by default).

chown root: Debian-exim / etc / exim4 / passwd

640 chmod / etc / exim4 / passwd

Run update-exim4.conf and we reboot our server (I prefer full restart if possible, and if not possible we can make a service restart with /etc/init.d/exim4 restart.

NOTE: Some anti-spam checks detect whether our SMTP server is configured with "requires authentication", and therefore need to activate it.

We will continue with this article SSL installed for our IMAP connection is encrypted.

To do this, install imap-ssl by: apt-get install courier-imap-ssl

Us in installing a terminal window appears informing you that we will create a certificate in / etc / courier and that interests us is the imapd.pem at this location. We must eliminate, for example "rm / etc / courier / imapd.pem"

press OK.

Edit the file / Etc / courier / imapd.cnf and modify the lines:



L = Barcelona

CN =

[Email protected]

Save the file and run from the command console mkimapdcert to generate the new certificate.

In our setup the Evolution client, for example, will mark in Safety "Use secure connection" SSL Encryption "and when you restart the client will show us that we must accept the certificate. A good example would be sniffing the traffic, but we leave this for another article.

Well, for now, we have seen how to install Exim server, configured with an IP address dynamically via no-ip, create an SMTP authentication, generate an SSL certificate for our IMAP client. We still pending Spam module installation to have our entire mail system. This point we will leave for a later article.

Related Posts Plugin for WordPress, Blogger ...
Tags: , , , , , , , , , , , ,

Leave a Reply

XHTML: You can use in Original tags: <a href="" title=""> <abbr title = ""> <acronym title = ""> <b> <blockquote cite = ""> <cite> <code> <del datetime = ""> <em> <i> <q cite = ""> <s> <strike> <strong>

GTranslate Your license is inactive or expired, please subscribe again!