I heartily recommend Exim4. I find it to be BY FAR the easiest/best email server for “send only” operations. It is a full MTA so you don’t need to rely on outside relays (gmail is commonly used with things like phpsendmail). Being a full MTA means that it can do a lot more but I haven’t ventured into using it for that and it is outside of the scope of this short article.

It should be noted that I am working on Ubuntu 14.04 LTS Server, however this will probably work on any debian variant of linux.

RHEL, Centos, Slackware, etc… go elsewhere.

So, if you need direct, send-only mail operations from your server, then here is a quick one liner for installing AND CONFIGURING Exim4:

First elevate yourself to root (okay, this is one EXTRA command…)

sudo su

Then…

apt-get update && apt-get -y install exim4 && cp /etc/exim4/update-exim4.conf.conf /etc/exim4/update-exim4.conf.conf.backup && sed -i 's/'dc_eximconfig_configtype=\'local\''/'dc_eximconfig_configtype=\'internet\''/g' /etc/exim4/update-exim4.conf.conf && sed -i 's/'dc_local_interfaces=\'127\.0\.0\.1\ \;\ \:\:1\''/'dc_local_interfaces=\'127\.0\.0\.1\''/g' /etc/exim4/update-exim4.conf.conf && service exim4 restart

I wrote that myself because I got really tired of manually configuring Exim every time I needed to install it. That command makes a backup of the default config file and then writes in the stuff to the active config file that makes it good for “send only” operations. It also locks it down so that only the local server can send email and you don’t end up with an open relay which is a bad thing.

Emails sent by your server will end up in JUNK by default for most providers. Additional setup of other stuff is needed to keep that from happening. This is really for Server Administrators and people that need to get alerts and whatnot from their box. You can whitelist in your receiving inbox to make sure emails don’t go to junk.

Cheers!

1 of 1

5 comments on: Install Exim4 MTA and configure for SEND ONLY Email Operations – One Command

  1. Pingback: OpenVPN Access Server – BASH Script to Email an Access Report « KiloRoot

  2. Pingback: Linux Server Boot Partitions Get Full – Simple Script to Email an Alert « KiloRoot

  3. Pingback: DKIM and SPF with Exim4 – Better Mail Delivery « KiloRoot

  4. buzcuz
    Reply

    Hi. Thanks for the this. I was looking for somthing like this. i also followed your post on BASH Script to Email an Access Report .
    I need some help.
    I have installed exim4 on a server at home behind my router, i have followed your intruction to the T , but no email are send. Must i do some firewall config on my server our open a port on my router?

    sorry for my poor english.

  5. nbeam
    Reply

    Port 25 is going to have to be open outbound. Furthermore, if you are trying to do this on a system at your house, most likely your home internet provider is blocking outbound port 25 traffic. 🙁 – I ran into this same issue while testing a few weeks ago. If that is the case, most likely you will need to do something else. You best bet in that scenario is, if you have a gmail account, then use Google’s SMTP servers to forward/relay email and connect to them on a different port. I don’t have the exact instructions handy but if you do a bit of web searching you should come across something that should explain the process.

Leave a Reply to nbeam Cancel reply

Your email address will not be published. Required fields are marked *