Debian has been installing Exim4 as the default MTA since at least Debian Stretch. When I tried to use it to send service messages (specifically fail2ban ban reports including whois information) on a new bookworm server, the messages would bounce with an Exim “message has lines too long for transport” error.

Most modern MUAs like Outlook fold or wrap long message & header lines and do not cause this issue. However, log files lines, certificate details, etc often exceed the RFC max line length of 998 characters and most server status / reporting utilities are not built to wrap these lines for emailing.

It took a lot of work to find a fix for this error in Debian. Debian has its own system for modifying Exim config files and using either config snippets or a single large config file.

The fix is to add this line to the config:


Starting with the Exim4 versions included in Debian Stretch, the RFC max line length of 998 characters is enforced, and emails with lines exceeding this length are returned to sender. For more info see:

You need to add this line to /etc/exim4/update-exim4.conf.conf and then follow the instructions to run

$ sudo update-exim4.conf

When you do, it is going to generate a strange message:

undocumented line IGNORE_SMTP_LINE_LENGTH_LIMIT=1 found in
/etc/exim4/update-exim4.conf.conf, generating exim macro

Then restart the service:

$ sudo service exim4 restart

You can test the fix by sending a really long message:

{ echo "Test begins"; for ((i=0; i<1500; i++)); do echo -n "0"; done; echo -e "\nTest ends"; } | mail -s "Very long line"

Leave a Reply

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