Setting up a mail server in Linux environment is something that every Linux admin knows or should know. In case, you too are planning to enhance your Linux skills, this tutorial is for you.
There are a number of mail server software that can be installed on Linux, like Postfix, Sendmail, Exim, Qmail etc. Generally, Postfix and Exim mail servers are configured with hosting control panels like Plesk and CPanel. Here in this write-up, we’ll provide steps that can be used for quickly setting up Exim Mail Server on CPanel/WHM hosting control panel.
Once you have your CPanel installed and logged into WHM, then in search box, type keyword ‘Exim Configuration Manager’ or get it via path – Home »Service Configuration »Exim Configuration Manager to begin installation.
You’ll get this screenshot below when Exim Configuration Manager opens:
Here, we can change or customize settings of already installed Exim with Default configuration. Cpanel Exim Configuration Manager comes with many tabs so that it can be easily configured with mail server’s already compiled-in modules or options. Tabs include:
- Basic Editor: For basic and most general Exim configuration settings.
- Advanced Editor: Should only be modified if you have deep knowledge about the modules or specific options.
- Backup/Restore: To backup or restore Exim configuration.
- Reset: To make Exim reset with default version set (like factory reset) if the customization was not appropriate.
Moving ahead, we are going to do a quick setup of mail server with the help of Basic editor tab. This tab is generally used by beginners to configure Exim mail server, and they can configure it with certain basic or required options.
The Basic Editor tab is again divided into sub tabs and various options like, ACL Options, Access Lists, Domains and IPs, Filters, Mails, RBLs, Security, Apache SpamAssassin etc.
These options available under each sub tab of Basic Editor can be used for customizing default settings as per requirement- the way you want MTA to perform for your server and hosted domains.
A brief introduction for each sub tab is given below:
- ACL/Access Lists: Access Control List controls incoming mails or connections or verifications, protects servers against attacks, like dictionary attacks and so should be left with default parameters.
- Domains and IPs: This tab describes mails’ outbound connections via specific domains or server’s main IP. (Here, Outbound IP of Exim can be configured through which mails can be sent).
- Filters: This tab helps to configure filters for blocking spam and infected attachments.
- Mail/RBLs: This tab can be used for keeping checks over incoming mails based on RBL databases – incoming mails can be rejected on the basis of bad IP reputation, keeping checks to stop and fight SPAM and allows legitimate mails or senders to make connections with server.
- Security/Apache SpamAssassin: This helps in providing security to outbound mails as it has the option to scan mails for any infection or virus and prevent SPAM mails on the basis of calculative spam score.
Once modifications or tweaks are done on the configuration manager, we can save the changes.
These changes should directly reflect in configuration file that resides at /etc/exim.conf and it should not be edited manually.
Bingo! Now you have a working mail server ready for mailing through the server for hosted domains or accounts or users. 🙂
Some most important DNS or records settings which should be done before starting the mailing process are given below:
- A valid rDNS, Reverse DNS Pointer (PTR) record of the mail server hostname or domain name should be created.
- Proper SPF/DKIM/DMARC, DNS Record is required for email verification and validation.
Be assured of happy mailing by doing a quick check up for mail servers’ IP reputation and open relay check with all the required DNS records that they are properly created and propagated.
A mail server should not have bad reputed IP and should not be prone to open relay for unauthorized mailings via attackers or spammers.
Refer URL provided below for a quick check up of IP reputation and server Open Relay:
Here are some commands that you can use to troubleshoot, monitor and trace Exim Mail server:
- To check the number of established SMTP connections over port ‘25’ one should run the following command:
#netstat -ntlaupe |grep ‘:25’|grep ESTABLISHED
- Mail logs are saved in the file at location /var/log/exim_mainlog. Following command can be run to check mail logs for error in delivery of messages:
#tail -f /var/log/exim_mainlog
Here are some Shell commands for mail queue:
- Reprocessing the mails residing in the mail queue:
- Identifying the number of messages in the mail queue:
- Listing the messages in the mail queue:
- Getting summary of the mail queue:
#exim -bp | exiqsumm
- Getting header info of the message:
#exim -Mvh Msg_Id
- Getting body info of the message:
#exim -Mvb Msg_Id
In case you have any further query about mail server installation or have any feedback about this write-up, just let me know through comments below.
A CCNA and RHCE certified professional, Himanshu has been looking after ZNetLive’s Linux systems’ administration for over six years now. With master’s degree in IT, he has hands-on experience in designing, developing and managing organizational IT infrastructure to meet company’s business goals. A core techie at hea......