Is there a way to get PHPMailer to send SMTP messages with longer than 76 character lines?
$mail->WordWrap = 0;
But that doesn’t seem to work.
$mail->Encoding = "8bit";
that doesn’t seem to work either.
The message body is just plain text. I’m needing it to be parsed by another script that I send it to. But I need the body to be completely in one line. That’s how I pass it to $mail->Body.
Am I missing something?
By default email uses quoted printable encoding. On the receiving side you should be able to do
$body = quoted_printable_decode($mail->Body);
to get the body back in one line.
It may be that the code is sticking to this suggestion from the mail format RFC: “Each line of characters MUST be no more than 998 characters, and SHOULD be no more than 78 characters, excluding the CRLF.”
PHPMailer seems to split the message to 76 chars if it’s set to Base64 encoding, and if it’s using
mail() as the underlying mail transport.
Using PHP’s mail() function seems to work as I would expect. The line remains intact and long.
For the time being my work around is to use mail() for this particular instance instead of PHPMailer.
But this still makes me wonder… why can’t PHPMailer do this?
Shouldn’t the question be “Shouldn’t mail() not do this?”
2.1.1. Line Length Limits
The 998 character limit is due to limitations in many implementations
which send, receive, or store Internet Message Format messages that
simply cannot handle more than 998 characters on a line.
The more conservative 78 character recommendation is to accommodate
the many implementations of user interfaces that display these
messages which may truncate, or disastrously wrap, the display of
more than 78 characters per line, …
I guess as long as you know there won’t be any limit problems for your particular use case you could take advantage of the undocumented mail() “feature”. But I have the feeling there may be a better way to do what you want that is not so risky.
implode the lines on the receiving end?
I had not thought of this. And this seems like a workable solution. Many thanks!
This a valid question. Perhaps the use of quoted_printable_decode() on the receiving end is a better solution.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.