wssmail uses PHPMailer standalone on the frontend to send messages using SMTP, and PHPMailer does not currently support format=flowed, so we need to push that through so that messages are generated correctly.
/* Create a format=flowed plain text body (RFC 3676 - 4.2) */
$ffbody = "";
$line = strtok($body, "\n");
while ($line !== false) {
rtrim($line); /* Trim spaces before user line breaks */
if (substr($line, -1) === "\r") {
/* Also strip CR if present */
$line = substr($line, 0, -1);
}
/* Need to space stuff.
* Could use str_starts_with, but use substr for <8 compatibility */
if (substr($line, 0, 1) === " " || substr($line, 0, 4, "From") || substr($line, 0, 1, ">")) {
$line = " " . $line;
}
/* Now it's deterministic
* Wrap each line at 76 characters, with a space after to make it format=flowed.
*/
$line = wordwrap($line, 76, " \r\n");
$ffbody .= $line . "\r\n";
$line = strtok("\n");
}
Once that is upstreamed and integrated, perhaps we can submit wssmail as an example here: https://useplaintext.email/#thunderbird (evergreen could also be included)
You must be