Error: message has lines too long for transport

Post Reply
User avatar
isscbta
Team Member
Posts: 151
Joined: Mon Jul 19, 2021 1:41 am
Has thanked: 18 times
Been thanked: 3 times

If your users receive bounced emails with the following error:

Code: Select all

message has lines too long for transport
here’s what’s really going on and how to solve it.

Why does this happen?

Some email clients (most often Microsoft Outlook, especially after copy/paste from Word) can generate emails where a single line exceeds the standard SMTP line length (998 characters). By default, Exim (the mail server used by myVesta) will block or fail to forward these emails, resulting in the above error.

How to fix:

Edit your Exim configuration template:
Open this file:

Code: Select all

/etc/exim4/exim4.conf.template
Find this parameter:

Code: Select all

message_linelength_limit
You may see it in more than one section, usually in

Code: Select all

remote_smtp
and

Code: Select all

remote_forwarded_smtp
Uncomment it (remove the #), and set a very large value:

Code: Select all

message_linelength_limit = 1G
You can also set it to 0 if you want to completely disable the limit.
Do this for every section where you find this parameter.

Update your Exim configuration and restart the service:

Code: Select all

update-exim4.conf
systemctl restart exim4
You can use the following test command (it might not actually deliver the email, but you will see in the log whether the error still appears):

Code: Select all

echo -e "Subject: Test long line\nTo: [email protected]\nFrom: [email protected]\n\n$(printf 'A%.0s' {1..1500})" > /tmp/testlongline.txt
exim -v [email protected] < /tmp/testlongline.txt

A few notes
  • This change tells Exim to accept (and forward) messages with lines much longer than the RFC standard, solving compatibility issues with some clients.
  • After making this change, emails that previously bounced due to this error should go through without problems.
  • If you want to strictly follow the RFC, you might keep the limit, but in the real world, relaxing it avoids headaches for your users.
Post Reply