1. Home
  2. Email
  3. Troubleshooting
  4. How to resolve – Message has lines too long for transport

How to resolve – Message has lines too long for transport

Overview

The error “Message has lines too long for transport” occurs when an email contains excessively long lines that exceed the limits imposed by the email transport system. This can lead to delivery failures, particularly when sending emails through SMTP servers that enforce strict line length rules.

This guide provides:

  1. A technical explanation of why this error occurs.
  2. Step-by-step troubleshooting methods.
  3. Advanced fixes, including server-side adjustments.
  4. Technical references and best practices.

Why Does This Error Occur?

Email protocols, such as SMTP (Simple Mail Transfer Protocol), impose a line length limit to ensure compatibility across different email systems. According to RFC 5322, the maximum line length for an email is 998 characters (with a recommended limit of 78 characters for readability).

Common Causes:

  1. Base64-encoded attachments: Some email clients improperly encode large attachments, causing excessively long lines.
  2. Poorly formatted HTML emails: Minified or improperly wrapped HTML emails may exceed the line length limit.
  3. Mail client configuration issues: Some email clients or scripts fail to wrap lines correctly.
  4. SMTP server limitations: Some mail servers enforce stricter line length policies.
  5. Word wrapping disabled: If a mail system does not break long lines, they might be rejected by certain transport layers.

How to Fix “Message Has Lines Too Long for Transport” Error

1. Enable Word Wrapping in Your Email Client

Ensure your email client automatically wraps lines at 78 characters for better compatibility:

For Microsoft Outlook:
  1. Open Outlook and go to File > Options.

  2. Select Mail from the left panel.

  3. Scroll down to Message format.

  4. Ensure Automatically wrap text at 78 characters is enabled.

For Mozilla Thunderbird:
  1. Open Thunderbird, go to Preferences > General.

  2. Under Composition, enable Wrap plain text messages at 78 characters.

2. Check Email Formatting in HTML Messages

If you’re sending HTML emails, ensure proper line wrapping:

  • Use <br> or <p> tags instead of manually creating long lines.

  • Avoid minifying HTML to extreme lengths.

  • Ensure HTML content is formatted using a mail editor that properly breaks lines.

3. Verify Email Attachments Encoding

Attachments should be properly encoded to prevent excessive line lengths:

  • Use MIME Base64 encoding, ensuring line breaks occur every 76 characters.

  • If your email system allows, use Quoted-Printable encoding for better readability.

4. Modify SMTP Server Settings

If you’re an administrator, adjust SMTP settings to handle long lines more efficiently.

For Postfix (Linux-based mail servers):
  1. Open the configuration file:

    sudo nano /etc/postfix/main.cf
  2. Add the following line to allow longer transport lines:

    smtp_line_length_limit = 2048
  3. Restart Postfix:

    sudo systemctl restart postfix
For Exim:
  1. Locate your configuration file (usually /etc/exim/exim.conf).

  2. Add or update:

    message_size_limit = 52428800
  3. Restart Exim:

    sudo systemctl restart exim

5. Adjust Email Sending Scripts

If sending emails via scripts (PHP, Python, etc.), ensure correct line wrapping:

PHP Mail Function Fix:
$headers = "Content-Type: text/plain; charset=UTF-8" . "\r\n";
$message = wordwrap($message, 78, "\r\n");
mail($to, $subject, $message, $headers);
Python SMTP Fix:
import smtplib
from email.mime.text import MIMEText

message = MIMEText("Your message content here", "plain", "utf-8")
message["Subject"] = "Your Subject"
message.as_string().replace("\n", "\r\n")

Advanced Troubleshooting

1. Check Mail Server Logs

If the issue persists, analyze server logs for errors:

  • Linux (Postfix logs):

    sudo cat /var/log/mail.log | grep transport
  • Windows (Exchange logs): Navigate to C:\Program Files\Microsoft\Exchange Server\V15\Logging\TransportRole.

2. Test Email with a Different Client

If the error occurs only with a specific email client, try sending from a different one (e.g., switch from Outlook to Thunderbird).

Summary

Issue Solution
Long lines in email body Enable word wrapping in the email client
HTML emails breaking transport limits Ensure proper formatting and line breaks
Attachments causing long lines Use Base64 encoding with correct line breaks
SMTP server rejecting emails Adjust Postfix/Exim settings
Custom scripts sending unwrapped lines Use wordwrap() in PHP or adjust MIME settings in Python

References

By following these steps, you can resolve the “Message has lines too long for transport” error and ensure smooth email delivery across different mail servers

Need more help with the email accounts on your 1-grid web hosting account? Visit the email category of our knowledge base.

Updated on February 5, 2025

Was this article helpful?

Related Articles