Mozzi
November 4, 2021, 6:06pm
1
Hi Guys
PHP - Send Mail ? Compatible with php 8?
My host has send me a mail to say they upgrading to php 8 in the next couple of days.
So i set the server to php 8 to check the compatibility.
I test the “send mail” in php 7.4 and I get the mail rendered 100% when it arrives in Outlook.
So then the next step is to change the server config to php 8.
So its all sending… but when it arrives … it does not show as HTML.
Comes out as “This is a multi-part message in MIME format.”
I have checked the server setting in the send mail, and all seems good.
I have even made sure I have the latest dmxConnectLib folder
So the problem comes in if I switch to php 8
Is this some setting at the HOST that they must change… or something i can do to get the mails to render as “HTML” in php8. In php 7.3 and 7.4 seems fine…
Mozzi
November 5, 2021, 6:02am
2
… weird … ok seems like im the only one using php 8 since its been out … wow! … guess everybody just went back to php 7.4,
credit is due to this post for solving it
opened 07:42AM - 24 Mar 21 UTC
closed 06:22AM - 19 May 21 UTC
Steps to reproduce the issue
System - Global Configuration - Server - Mail Settings - Mailer should be set to "PHP Mail"
Run...
No Code Attached Yet
@patrick
But after a few hours of searching last night… i got the answer.
I updated the PHPMAILER script, and its working on both 7.4 and 8 i can confirm my side.
Line 856 PHPmailer where the function starts. I added. Just above the results!
We added
$header = str_replace("\n", "\r\n", $header);
so that the script works like this…
private function mailPassthru($to, $subject, $body, $header, $params)
{
//Check overloading of mail function to avoid double-encoding
if (ini_get('mbstring.func_overload') & 1) {
$subject = $this->secureHeader($subject);
} else {
$subject = $this->encodeHeader($this->secureHeader($subject));
}
//Calling mail() with null params breaks
if (!$this->UseSendmailOptions || null === $params) {
$header = str_replace("\n", "\r\n", $header);
$result = @mail($to, $subject, $body, $header);
} else {
$header = str_replace("\n", "\r\n", $header);
$result = @mail($to, $subject, $body, $header, $params);
}
return $result;
}
Its working on my side now… but please can @patrick confirm if this is OK…
Will update to latest PHPMailer, it seems to be fixed there.
Teodor
November 11, 2021, 8:59pm
6
This has been fixed in Wappler 4.3.0
1 Like
Teodor
Closed
November 15, 2021, 4:00pm
8
This topic was automatically closed after 3 days. New replies are no longer allowed.