Want to set up an Exim Smarthost for a specific domain?

A Smarthost is an intermediate mail server that offers a smarter way to filter emails. This is quite simple with a few configuration settings.

At Bobcares, we often get requests to configure Exim smarthost, as a part of our Server Management Services.

Today, we will see how our Support Engineers do this for our customers.

 

Why do we set up Exim smarthost for a specific domain?

Basically, a smarthost is an intermediate server between a sender and recipient. A smarthost can easily relay mails in a smarter way.

Many times, certain domains in the server may require custom email solutions. For instance, some domains may need to use an external third party spam filter. In such cases, to get the benefits all mails need to go through this smart host.

Additionally, SmartHost can be a solution when managing high email traffic using mail servers like Exim. We use this for servers that face problems in sending emails via standard email routing.

 

How to set up a smarthost for a specific recipient domain?

The smarthost setup needs few tweaks in the existing mail server configuration.

Now, let us check out how our Support Team relays the mails for specific recipient domains. Here we will see the configuration for an Exim mail server using cPanel.

Initially, we create a file to hold the static routes.

touch /etc/staticroutes

chown root:mail /etc/staticroutes

Next, we log into WHM. Later navigate as  Exim Configuration Manager >> Advanced Editor.

Here we find the box Section: ROUTERSTART. And we add the following,

static_route:
driver = manualroute
transport = remote_smtp
route_data = ${lookup{$domain}partial-lsearch{/etc/staticroutes}}

Then we save the changes and restart the Exim service.

Finally, we add the domains in the staticroutes file. That is, we open the file /etc/staticroutes

And add the smarthost IP or hostname as,

example.com: xxx.xxx.x.x

This ensures that smarthost is set up correctly.

 

How to set up a smarthost for a specific sender domain?

Similarly, we can also configure smarthost for sending mails from a domain. Let us see how our Support Engineers do this for Exim.

Firstly, we open the Exim local config file. That is, /etc/exim.conf.local

Then we add the following code under respective sections.

In section @CONFIG@, we add,

Exim smarthost for specific domain.

Whereas, in @ROUTERSTART@, we add,

exim smarthost for specific domain.

Similarly, in @TRANSPORTSTART@, we add,

Exim smarthost for specific domain.

Most importantly, we make sure the following config files exist.

/etc/staticroutes

/etc/smarthosts

To regenerate the configuration we run,

/scripts/buildeximconf

Also, we ensure to add the smarthost domain name to the config files.

 

[Still having trouble in setting smarthost for a specific domain? We can help you.]

 

Conclusion

So far, we saw how to set up Exim smarthost for a specific domain. Here we saw the configuration for both sender and recipient. Today, we saw how our Support Engineers do this for Exim in cPanel.



Source link

Author

Write A Comment