# How to change the maximum mail size in Postfix

To change the maximum mail size in Postfix, you need to modify the configuration settings for Postfix. The maximum mail size is controlled by two main parameters: `message_size_limit` and `mailbox_size_limit`. Here's how you can change these settings:

### Edit the Postfix Configuration File

Open the Postfix main configuration file in your preferred text editor. The location of this file can vary depending on your system, but common locations are `/etc/postfix/main.cf` or `/etc/postfix/master.cf`. You may need superuser privileges to edit this file, so use `sudo` or `su` if necessary.

```bash
sudo nano /etc/postfix/main.cf
```

### Adjust the `message_size_limit`

To change the maximum allowed size of an individual email message, locate and modify the `message_size_limit` parameter. The value should be specified in bytes. For example, to set the limit to 20MB, you can use:

```bash
message_size_limit = 20971520
```

This sets the message size limit to 20 * 1024 * 1024 bytes.

### Adjust the `mailbox_size_limit` (Optional)

The `mailbox_size_limit` parameter controls the maximum size of a user's mailbox. You can also adjust this parameter if you want to limit the mailbox size. To set a 2GB limit, for instance, use:

```bash
mailbox_size_limit = 2147483648
```

### Save the Configuration File

Save your changes and exit the text editor.

### Reload Postfix

After making these changes, you need to reload the Postfix configuration to apply the new settings:

```bash
sudo postfix reload
```

### Test the Configuration

You should test your configuration to ensure that it's working as expected. Send an email with an attachment that is larger than your specified message size limit to see if it gets rejected or accepted.

Keep in mind that adjusting these limits should be done carefully. Setting overly large values may lead to resource utilization issues, while setting too low limits may cause legitimate emails to be rejected. Choose the limits based on your system's capacity and your specific use case. Additionally, consider the potential impact on both sending and receiving mail servers when making changes to message size limits.