Bobcares

Using MailScanner with Exim | How To?

by | Jan 11, 2023

The article explains the steps for using MailScanner with Exim. At Bobcares, with our Server Management Services, we offer solutions to your MailScanner and Exim queries.

Using MailScanner with Exim – How To?

The receiving and sending of messages are divided into two queues by MailScanner. However, on the other hand, Exim doesn’t support separate queues. Exim requires two separate Exim processes for the receiving and sending of messages. Now, we’ll look into the steps to use MailScanner with Exim.

  • Set-up Exim
  • Modify Spool Directory
  • Postpone Incoming Messages
  • Exim Version
  • Executing Exim
  • Set-up MailScanner
Set-up Exim

In this case, we are using the default src/EDITME build time setup for Exim. First, we must copy the active Exim configuration from /etc/exim/exim.conf to /etc/exim/exim_out.conf in order to use the outgoing Exim. This file shouldn’t be edited in any way. We’ll make changes to the default setup by using another spool directory and stopping Exim from delivering messages right away.

Modify Spool Directory

To the beginning of /etc/exim/exim.conf, we need to include the below code to change the spool directory.

Using MailScanner with Exim

With this MailScanner setup, the log lines relating to a message’s receipt and delivery will be in two distinct locations because Exim by default stores its logs in $spool_directory/log/%slog. If the operating system has packaged Exim to put its logs somewhere else, we won’t run into this issue. Put the following in the first section of both /etc/exim/exim.conf and /etc/exim/exim_out.conf to fix the issue:

Using MailScanner with Exim

The exiwhat utility also depends on a process status log that Exim puts in its spool directory. We can change it from Exim-4.21 and greater.

Postpone Incoming Messages

We can easily prevent Exim from delivering the message right away by including the below code in the beginning portion of the configuration file:

However, if we set prod_requires_admin = false, then any user can bypass MailScanner by using Exim parameters like -q and -M.

Exim Version

In order to make all messages deferred when Exim tries to deliver them, add this router immediately after the begin routers line in Exim 4, so that it is the first router:

Using MailScanner with Exim
Executing Exim

We need two separate Exim processes for incoming and outgoing messages. So, we’ve to change the Exim startup script. Find the line /usr/bin/exim -bd -q15m, then replace it with the below codes:

Using MailScanner with Exim

The queue-running Exim will not create a pid file; however, the SMTP listener will by default create its pid file in /var/spool/exim.in/exim-daemon.pid. To get it to do that, modify its command line to:

It is not necessary to clean all the DBs of both the Exim processes. However, a crontab for Exim that cycles the logs and cleans up the hints databases is really helpful.

Also,

Using MailScanner with Exim

Some users run Exim from inetd for incoming SMTP and cron for queue runs. We also don’t need to change inetd.conf, but we do need to modify the queue running the command in the crontab to the below code:

Set-up MailScanner

We can use two MailScanner settings to tell MailScanner to invoke exim. To send freshly prepared mail using MailScanner, utilize the “Sendmail” setting (i.e. warnings). Use a straightforward setup like this one:

We can bypass the warnings using the code:

We might additionally want to instruct Exim to mark messages produced by MailScanner in the log as follows:

The “Sendmail2” setting attempts to deliver a message that is already scanned. It defaults to being the same as the “Sendmail” setting, but we need to tell Exim to use the outgoing configuration:

The locations of the Exim incoming and outgoing spool directories must also be specified for MailScanner. These settings will function in the simplest scenario; however, MailScanner must be explicitly informed of the input subdirectory, which is implied in the Exim setup.

The setup varies lightly if the Exim setup includes a split spool directory:

Using MailScanner with Exim

We’ll be having this option at the end of default MailScanner.conf. Also, before initiating MailScanner for the first time, make sure to create spool directories and subdirectories. We also need to specify the Exim user as:

Using MailScanner with Exim

[Searching solution for a different query? We are just a click away.]

Conclusion

To conclude, we’ve included the steps from our Support team for using MailScanner with Exim in this article.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

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

Never again lose customers to poor
server speed! Let us help you.