Exim4 line length in Debian Stretch – “Mail delivery failed: returning message to sender”

Exim4 introducted new behaviour in the versions included in Debian Stretch. Suddenly, the RFC max line length of 998 characters is enforced, and emails with lines exceeding this length are returned to sender. For the interested, part of the discussion about this feature is over here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=839147

Anyway, the solution to this issue in Debian is to add the following to /etc/exim4/update-exim4.conf.conf

IGNORE_SMTP_LINE_LENGTH_LIMIT='true'

..then restart Exim4

service exim4 restart

You can test the new configuration by sending an email to ‘root’ with an absurdly long line in it:

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

If you get that email, you did this correctly 🙂

3 Comments

  • Tomaž says:

    I found your post after looking into why some mail generated by logcheck continuously got frozen. It turned out that logcheck wasn’t breaking absurdly long lines from an Apache log and exim was rejecting the mail because of the issue you mention. Thanks for pointing me in the right direction.

  • Graham says:

    Thank you for this – finally solved the mystery of why my electricity supplier’s emails were occasionally going missing.

  • MJ Ray says:

    Wouldn’t it be better to add it to a file in /etc/exim4/conf.d/main (if using split config) instead of update-exim4.conf.conf?

1 Trackback

Leave a Reply

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