Exim4
- Install exim4, if it’s not installed already:
apt-get install exim4 exim4-base exim4-config exim4-daemon-light
- Configure now your exim4. Run:
dpkg-reconfigure exim4-config
You’ll be asked a bunch of questions. I won’t go through every single step, but you can cross-check with your
/etc/exim4/update-exim4.conf.conf
:dc_eximconfig_configtype='smarthost' dc_other_hostnames='my-own-domain-name.com' dc_local_interfaces='192.168.178.1' dc_readhost='' dc_relay_domains='my-own-domain-name.com' dc_minimaldns='false' dc_relay_nets='192.168.178.0/24' dc_smarthost='smtp.provider.com' CFILEMODE='644' dc_use_split_config='false' #--> leads to an error (see troubleshouting) dc_hide_mailname='false' dc_mailname_in_oh='true' dc_localdelivery='cyrus_delivery'
The second IP in
dc_local_interfaces
stands for your mail server IP address and it will make it listen on port 25, so you can receive mails, too. Adjust ‘smtp.provider.com‘, it’s your provider, which deliver your mails for you. Usually it’s the same, offers pop3/imap, too. - Provide in the config file below its account and password:
Add this line to your/etc/exim4/passwd.client
accordingly:smtp.provider.com:john.doe:my-secret-password
Note: All your mails will be send with this user.
- Add your Exim user to the mail group:
sudo adduser Debian-exim mail
and restart exim4
- The configuration in
/etc/exim4/update-exim4.conf.conf
is intended to receive e-mails for your my-own-domain-name.com. If you do have an user john configured at your box. So john@my-own-domain-name.com would be a valid e-mail address, and cyrus would handle it for you. Create this file/etc/exim4/conf.d/transport/30_exim4-config_cyrus_delivery
and paste this content in it:cyrus_delivery: transport_filter = /usr/bin/tr -d ' 00' driver = lmtp #socket = /var/run/cyrus/socket/lmtp #--> leads to an error (see troubleshouting) batch_max = 20 user = Debian-exim command = "/usr/sbin/cyrdeliver -l -m user.$local_part" group = mail
You also need a dyndns name and a port-forwarding of port 25 to your box, where your mail-server is running.
- Test your installation now
Perform a
update-exim4.conf
again and do a:/etc/init.d/exim4 restart
echo test | mailx -s test john.does.google.account@googlemail.com
You yet don’t need to remove the comment from your cronjob line. Just perform a test email to an e.g. webmail account like googlemail or hotmail, and see if it works.
If you succeed in receiving your test mail, you can remove the hash from your cronjob now, and see if your emails are also coming in.
If yes, your email server is now fully installed and configured. Congratulations! If not, check every single step above 😉
Configure now your local email client (e.g. Thunderbird, Outlook, whatever) with your new IMAP account (john).
Troubleshouting
Exim configuration error:
2011-06-08 14:34:27 Exim configuration error: one (and only one) of command or socket must be set for the cyrus_delivery transport Invalid new configfile /var/lib/exim4/config.autogenerated.tmp, not installing /var/lib/exim4/config.autogenerated.tmp to /var/lib/exim4/config.autogenerated
then you probably did a mistake in the conf.d/router or conf.d/transport config files.
In my case I had an additional socket defined in /etc/exim4/conf.d/transport/30_exim4-config_cyrus_delivery
. Uncomment it.
transport "cyrus_delivery" not found in local_usr router
If you get this after invoking
exim -d+all -bt john@my-own-domain-name.com
14:38:56 2765 --------> local_user router <-------- 14:38:56 2765 local_part=john domain=14:38:56 2765 --------my-own-domain-name.comgt; local_user router my-own-domain-name.comlt;-------- 14:38:56 2765 checking domains 14:38:56 2765 cached yes match for +local_domains 14:38:56 2765 cached lookup data = NULL 14:38:56 2765 14:38:56 2765 --------my-own-domain-name.comgt; local_user router my-own-domain-name.comlt;-------- in "+local_domains"? yes (matched "+local_domains" - cached) 14:38:56 2765 checking local_parts 14:38:56 2765 john in "! root"? yes (end of list) 14:38:56 2765 checking for local user 14:38:56 2765 seeking password data for user "john": using cached result 14:38:56 2765 getpwnam() succeeded uid=1000 gid=1000 14:38:56 2765 expanding: R: local_user for $local_part@$domain 14:38:56 2765 result: R: local_user for john@14:38:56 2765 --------my-own-domain-name.comgt; local_user router my-own-domain-name.comlt;-------- 14:38:56 2765 R: local_user for john@14:38:56 2765 --------my-own-domain-name.comgt; local_user router my-own-domain-name.comlt;-------- 14:38:56 2765 calling local_user router 14:38:56 2765 local_user router called for john@14:38:56 2765 --------my-own-domain-name.comgt; local_user router my-own-domain-name.comlt;-------- 14:38:56 2765 domain = 14:38:56 2765 --------my-own-domain-name.comgt; local_user router my-own-domain-name.comlt;-------- 14:38:56 2765 local_user router: defer for john@14:38:56 2765 --------my-own-domain-name.comgt; local_user router my-own-domain-name.comlt;-------- 14:38:56 2765 message: transport "cyrus_delivery" not found in local_user router john@14:38:56 2765 --------my-own-domain-name.comgt; local_user router my-own-domain-name.comlt;-------- cannot be resolved at this time: transport "cyrus_delivery" not found in local_user router 14:38:56 2765 search_tidyup called 14:38:56 2765 >>>>>>>>>>>>>>>> Exim pid=2765 terminating with rc=1 >>>>>>>>>>>>>>>>
or if you see this in your /var/log/exim4/mainlog
2011-06-08 13:52:52 H=mo-p05-fb.rzone.de [81.169.146.183] F=<> temporarily rejected RCPT <root@my-own-domain-name.com>: transport "cyrus_delivery" not found in local_user router
then you probably have dc_use_split_config
set to false
.
Set it to true
, and your changes and additional file in /etc/exim4/conf.d/transport
will be respected. Perform a update-exim4.conf
again and the error should be gone.
after update-exim4.conf
References: