#1 November 17, 2023 3:50pm

doon.mok
Member
Registered: May 6, 2015
Posts: 144

Daily Digest email comes in html code

We recently updated to bigtree 4.5.7 and PHP 8.1.16. Our daily digest now comes all in html code.
Html code shows up in gmail and hotmail.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
        <head>
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                <title>Daily Digest</title>
        </head>
...

We were using Local Server in the Email Deliver tab. We are trying to see if SMTP tab makes a difference but when I try to run cron using the instructions below, I get errors.
https://www.bigtreecms.org/developers/d … ly-digest/
I can't test what comes through and have to wait 24 hours for the next email.

Cron

php -f /.../.../.../core/cron.php
<br />
<b>Warning</b>:  Undefined array key "SERVER_PORT" in <b>/.../core/inc/bigtree/utils.php</b> on line <b>367</b><br />
<br />
<b>Warning</b>:  Undefined array key "SERVER_NAME" in <b>/.../core/inc/bigtree/utils.php</b> on line <b>370</b><br />
<br />
<b>Warning</b>:  Undefined array key "REQUEST_URI" in <b>/.../core/inc/bigtree/utils.php</b> on line <b>370</b><br />
<br />
<b>Warning</b>:  Undefined array key "php_boot_error" in <b>/.../core/inc/bigtree/admin.php</b> on line <b>608</b><br />
<br />
<b>Warning</b>:  Trying to access array offset on value of type null in <b>/.../core/inc/bigtree/sitemap.php</b> on line <b>105</b><br />
<br />
<b>Warning</b>:  Trying to access array offset on value of type null in <b>/.../core/inc/bigtree/sitemap.php</b> on line <b>105</b><br />
<br />
<b>Warning</b>:  Trying to access array offset on value of type null in <b>/.../core/inc/bigtree/sitemap.php</b> on line <b>105</b><br />

Do you have any recommendations on testing or what could be the issue?

Thanks

Last edited by doon.mok (November 17, 2023 3:53pm)

Offline

#2 November 17, 2023 4:15pm

doon.mok
Member
Registered: May 6, 2015
Posts: 144

Re: Daily Digest email comes in html code

We also compared an old header(email looks fine) vs broken header and some code on the same line.
Not sure if that makes a difference.

Working header

X-PHP-Script: .../site/index.php for 5.188.62.21
X-PHP-Originating-Script: 1000:phpmailer.php
Date: Mon, 23 Oct 2023 14:43:44 -0500
From: BigTree CMS <no-reply@....com>
Message-ID: <73e2a48e4f8a39a5aa60de103b361263@www.....com>
X-Mailer: PHPMailer 5.2.23 (https://github.com/PHPMailer/PHPMailer)
MIME-Version: 1.0
Content-Type: text/html; charset=iso-8859-1

Broken header

X-PHP-Script:.../site/index.php for 73.44.82.111 X-PHP-Originating-Script: 1000:phpmailer.php
Date: Fri, 17 Nov 2023 11:45:16 -0600 From: BigTree CMS <rfucli5@....com> Reply-To: no-reply@....com Message-ID: <75bbdac0573bd0087ca8e786e8d0fd89@....com> X-Mailer: PHPMailer 5.2.23 (https://github.com/PHPMailer/PHPMailer) MIME-Version: 1.0 Content-Type: text/html; charset=iso-8859-1

Offline

#3 November 19, 2023 1:33pm

doon.mok
Member
Registered: May 6, 2015
Posts: 144

Re: Daily Digest email comes in html code

I changed back to PHP 7.4.1 and the emails look correctly. So it must be something with PHP 8. 

The core/inc/bigtree/utils.php sendEmail function is checking if $html is empty or not.

if ($html) {
	$mailer->isHTML(true);
	$mailer->Body = $html;
	$mailer->AltBody = $text;
} else {
	$mailer->Body = $text;
}

The core/inc/bigtree/admin.php emailDailyDigest function does not seem to set $html.

Offline

#4 November 21, 2023 10:15am

doon.mok
Member
Registered: May 6, 2015
Posts: 144

Re: Daily Digest email comes in html code

After doing more testing, the $html was not the issue.
We had to use the SMTP tab instead of Local Server. Works fine in PHP 7 and 8.

Offline

Board footer

Powered by FluxBB

The Discussion Forum is not available on displays of this size.