Your Webhosting Questions
Answered by the Webhosting Experts

Configure Mail Server(Exim)

Exim is recommended and supported MTA for use with the @Mail application, as it includes additional functionality, including MySQL database lookups, which enhance the efficiency of @Mail and increase performance.

How Exim is configured

SMTP Configuration

Your Exim installation references configuration details from the file /usr/local/atmail/mailserver/configure. Open the file using your text editor (ex. Vi, Emacs, Notepad), and at the top of the file, you will find the following lines:

# Stop the SMTP if load > X
smtp_load_reserve = 20

# Avoid mail-delivery, queue messages if load > X
queue_only_load = 10

# Don’t run the queue if load > X
deliver_queue_load_max = 8

smtp_banner = “Welcome to the @Mail SMTP Server ( Exim v4 ) “

Details about the settings are given on the commented sentences before each declaration.The tags that follow each setting are the “markers” used by @Mail, so they can be configured via the WebAdmin easily. The values are changed when you edit your SMTP settings via the WebAdmin, so manual configuration of this part is not necessary.

MySQL Configuration

You can find the following lines in the “@Mail Custom Routers” section of your Exim configuration file:

# The MYSQL login details. hostname/database/username/password
hide mysql_servers = localhost/atmail/root/mypassword

Your SMTP service references SQL to get details like relay permissions, domain configuration among many others. This section defines the details needed by Exim to connect to MySQL. The mysql_servers line requires the hostname of the mySQL server, database name, username and password (Note: the password must be set in mySQL, as Exim does not accept a blank password)

In the same way as your SMTP settings, the tags are “markers” used by @Mail, so this can be easily configured via the WebAdmin – no manual configuration is necessary.

Mail Relaying – How it Works

When Exim delivers emails, they pass through a routine configured in the mailserver configuration file. This section defines how emails are handled, when they are sent or recieved by the server.

Address Routing

Before emails are recieved by the server, the sender-address is handled, or routed depending on how it is defined in your mailserver configuration file. The following is the default configuration for your @Mail installation, defined in the Routers section of your configuration file:

driver = dnslookup
domains = ! +local_domains
transport = remote_smtp
ignore_target_hosts = :

Exim checks if the domain is in the local domains by doing a DNS lookup on the domain name. If it is not in your local domains, the domain is treated as an outside address.

driver = redirect
data = ${lookup mysql{ MYSQL_ALIASES }}

Exim checks if the address has an alias. This router calls the custom @Mail router called MYSQL_ALIASES, which checks if the user has an alias in the database, or is included in a catch-all account.

driver = redirect
data = ${lookup mysql {MYSQL_FORWARD}{$value}}

Exim then checks if the account has a forwarding rule. If this is true, the message is diverted to the external account. This router calls the @Mail custom SQL router called MYSQL_FORWARD, which searches for configured forward-addresses in the database.

domains = ${lookup mysql {MYSQL_CHECKSPAM}{$value}}
senders = ! ${lookup mysql {MYSQL_WHITELIST}{$value}}
condition = ${if and { {!def:h_X-Spam-Flag:} {!eq {$received_protocol}{spam-scanned}} {!eq {$received_protocol}{local}} } {1}{0}}
driver = accept
transport = spamcheck

The address is then passed, and checked for any entries pertaining to it in the Whitelist. If the account is not in the whitelist, it is then checked for spam in the Transports section of the configuration file. This router uses the @Mail custom routers MYSQL_CHECKSPAM and MYSQL_WHITELIST, that check the domain names of the address in the Whitelist section of the database.

driver = manualroute
domains = ${lookup mysql {MYSQL_PURGESPAM}{$value}}
condition = “${if eq{$h_X-Spam-Flag:}{YES} {1}{0}}”
route_list = “* localhost byname”
transport = devnull
verify = false

If the email is marked as spam, Exim checks if the recipient has configured his/her account to automatically delete messages. If this is true, the email is automatically discarded.

driver = manualroute
domains = ${lookup mysql {MYSQL_MOVESPAMFOLDER}{$value}}
condition = “${if eq{$h_X-Spam-Flag:}{YES} {1}{0}}”
route_list = “* localhost byname”
transport = mysql_delivery_spamfolder
verify = false

Optionally, if the user has configured his/her account to forward messages to a “Spam” folder, the emails are placed in the folder the user has selected. It is then handled by mysql_delivery_spamfolder in the Transports section.

driver = accept
senders = ! ^.*-request@.*:\
! ^bounce-.*@.*:\
! ^.*-bounce@.*:\
! ^owner-.*@.*:\
! ^postmaster@.*:\
! ^webmaster@.*:\
! ^listmaster@.*:\
! ^mailer-daemon@.*:\
domains = ${lookup mysql {MYSQL_CHECKAUTOREPLY}{$value}}
condition = “${if !eq{$h_X-Spam-Flag:}{YES} {1}{0}}”
transport = mysql_autoreply

The recipient is then checked is it has a

Need More Personalized Help?

If you have any further issues, questions, or would like some assistance checking on this or anything else, please reach out to us from your account and provide your server credentials within the encrypted field for the best possible security and support.

If you are unable to reach your account or if you are on the go, please reach out from your valid account email to us here at: [email protected]. We are also available to you through our phone and live chat system 24/7/365.

Tags +