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

Steini Petur

Well-Known Member
Apr 24, 2016
118
33
78
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
15,188
2,415
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
692
33
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?
 

AlbertoFX

Member
Feb 15, 2016
5
0
51
Mexico
cPanel Access Level
Root Administrator
Hello @cPRex and all other cpanel mates, I have the same issue , i have exim 100.001000 !!! and i still receive the h... " too long" at many , many customers. Is there any date to achive a fix to this ?
I think is not serious by Cpanel dev team to take years to fix this. I know its not a game to program it, but come on ! you are the programmers, you have the source code .. I have many customer not happy here , all us are losing ...

Thanks for any reply.
 

RubenGouws

Registered
Jan 17, 2023
4
0
1
South Africa
cPanel Access Level
Website Owner
Im using cPanel email hosted through Godaddy. I can not access the Exim config file or know where to find it. I have spoken to their support team multiple times and they can also not find it. Any guidance would be really appreciated.