Search Our Database

How to configure maximum attachment size limit for Exim

Last updated on |
by

Introduction

This guide explains how to configure the maximum email size limit in Exim, the popular mail transfer agent (MTA) used by many Linux-based email servers. It is aimed at users who need to control email size limits for users to avoid server overload or meet specific organizational policies. Limiting the size of incoming and outgoing emails ensures efficient server performance and helps prevent users from sending excessively large attachments that could cause delivery delays.

 

Prerequisites

  • Root access to the server where Exim is installed
  • Basic knowledge of command-line interface (CLI) and text editor usage (e.g., nano or vi)
  • Familiarity with Exim configuration files

 

Step-by-Step Guide

1. Log in to your server as the root user or with a user that has sufficient privileges:

ssh root@your_remote_server_ip

 

2. Use a text editor such as nano or vi to open the Exim configuration file. The configuration file is typically located at /etc/exim.conf or /etc/exim4/exim4.conf depending on your system:

nano /etc/exim.conf

 

3. Inside the configuration file, search for the message_size_limit paramter by scrolling through the file or using the search function. Adjust the message_size_limit value to the desired maximum email size. The size can be set in megabytes. For example:

To set a 50MB email size limit, use:

message_size_limit = 50M

To set a 25MB email size limit, modify the line as follows:

message_size_limit = 25M

Note: The actual per email size limit will not be exactly the same as the setting, it will be slightly smaller than the value that you have set.

 

4. After modifying the message_size_limit, save the file and exit the text editor:

  • In nano press CTRL + X, then press Y to confirm changes and press Enter to exit.
  • In vi, press ESC, then type :wq and press Enter.

 

5. To apply the changes, restart the Exim service using the following command:

service exim restart

 

6. To ensure the changes have been successfully applied, send a test email with an attachment larger than the specified size limit to confirm that the email fails to send.

 

Conclusion

By following these steps, you can successfully configure the maximum email size limit in Exim. This limit helps manage server resources effectively and prevent issues caused by large email attachments. Be sure to monitor email traffic and adjust the limit as necessary to meet your organization’s requirements.

 

 

Article posted on 2 April 2020.