SOLVED Problem CPANEL-39824 : message has lines too long for transport - Since January 21, 2022

Steini Petur

Well-Known Member
Apr 24, 2016
97
23
58
Iceland
cPanel Access Level
Root Administrator
Fair enough @cPRex but I will promise you that people don't just stumble on this article you gave me, you can probably expect more people running into this throughout 2022 due to these limitations set by Exim v4.95
 

Dathorn_ADT

Active Member
Nov 16, 2002
42
2
158
cPanel Access Level
Root Administrator
Can you get me more detail on why it would be necessary to make that change on a DNSOnly machine? If I can get a good use case, I can always make a case with our developers to get the functionality added.
Logwatch emails are impacted by this on DNSOnly. Sure, those running DNSOnly should be capable of fixing this manually but there is absolutely a legitimate case.
 
  • Like
Reactions: cPRex

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
11,032
1,740
363
cPanel Access Level
Root Administrator
The most recent update gives you the option of changing the line length to a very large number, up to 1000000. You'll see the option listed in WHM >> Exim Configuration Manager under "Maximum line length for SMTP transports (Minimum: 1; Maximum: 1,000,000)"
 
  • Like
Reactions: steven059

Just Retro

Registered
Apr 4, 2022
4
0
1
Australia
cPanel Access Level
Website Owner
I had this problem and found it was the length of the body of the email. Using HTML emails, the issue of going longer than 70 characters, is quite easy. I wrote a blog on it to explain. In short add this line to your php code:

$message = wordwrap($message, 70, “\r\n”);

More explanations here:
Yeah... great site:
1654587117798.png

But otherwise I think you're on the right path as I think your fix will be the key to finally fixing my opencart shop, as I didn't know what the cause was.
I did change \system\library\mail.php in opencart from this:
Code:
    /**
     *
     *
     * @param    string    $text
     */
    public function setText($text) {
        $this->text = $text;
    }
   
    /**
     *
     *
     * @param    string    $html
     */
    public function setHtml($html) {
        $this->html = $html;
    }
To this:
Code:
    /**
     *
     *
     * @param    string    $text
     */
    public function setText($text) {
        $text = str_replace("\n","\r\n",$text);
        $text = wordwrap($text, 70, "\r\n");
        $this->text = $text;
    }
   
    /**
     *
     *
     * @param    string    $html
     */
    public function setHtml($html) {
        $html = str_replace("\n","\r\n",$html);
        $html = str_replace(">",">\r\n",$html);
        $html = wordwrap($html, 70, "\r\n");
        $this->html = $html;
    }
But it seems I'm still having emails blocked, bummer.

This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

[email protected]
message has lines too long for transport


Reporting-MTA: dns; hosting2.ro.hostsailor.com

Action: failed
Final-Recipient: rfc822;[email protected]
Status: 5.0.0
X-Exim-DSN-Information: Due to administrative limits only headers are returned

EDIT: Found the fix for all OpenCart users.
Open /system/library/mail/mail.php and encase every instance of base64_encode() with chunk_split()
So for example
Code:
$message .= base64_encode($this->html) . $eol;
would become
Code:
$message .= chunk_split(base64_encode($this->html)) . $eol;
That fixed all the emails, especially the gift certificate emails as they embedded images.
 
Last edited:

GoWilkes

Well-Known Member
Sep 26, 2006
659
31
178
cPanel Access Level
Root Administrator
The most recent update gives you the option of changing the line length to a very large number, up to 1000000. You'll see the option listed in WHM >> Exim Configuration Manager under "Maximum line length for SMTP transports (Minimum: 1; Maximum: 1,000,000)"
I've been having this problem for awhile, with Perl scripts sending to Gmail (no Outlook, no PHP). I found this thread while researching the problem.

I changed this setting to 65536, which I saw earlier in the thread but I don't know why that's the magic number instead of just going for 1000000?