Emails arriving partially blank

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
mlcrane
Posts: 27
Joined: 21 Apr 2011, 08:21

Emails arriving partially blank

Post by mlcrane »

MantisBT v1.3.0

Getting a weird error since upgrading to v1.3.0; emails are being sent, but they arrive partially blank - in Outlook no "From:" or "Subject" is displayed, but the body of the message contains all the right information.

I have spent the afternoon comparing what Mantis does against a simple PHPMailer test program (using 5.2.16 from the 1.3.0 install) and the same information (give or take) is going into ->Send(), but the difference in result is massive.

Screenshots attached - anyone want to offer any clues?
Mantis1.3.0-1.png
Mantis1.3.0-1.png (63.8 KiB) Viewed 4165 times
Mantis email
Mantis1.3.0-2.png
Mantis1.3.0-2.png (48.95 KiB) Viewed 4165 times
PHPMailer email
atrol
Site Admin
Posts: 8376
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Emails arriving partially blank

Post by atrol »

Seems to be an older (2007?) version of Outllook.
There is certainly a menu enty to view the source of the email.
This would allow you to have a look at a deeper level to the differences of the emails.
Please use Search before posting and read the Manual
mlcrane
Posts: 27
Joined: 21 Apr 2011, 08:21

Re: Emails arriving partially blank

Post by mlcrane »

Lookout 2003, in fact; just don't ask, it'll be better for us all...

The headers "match" what you see (annoyingly);

"Blank" email:
Microsoft Mail Internet Headers Version 2.0
Received: from svr-svn01.ggp.local ([10.0.0.11]) by ggpsystems.co.uk with Microsoft SMTPSVC(6.0.3790.4675);
Tue, 16 Aug 2016 15:33:22 +0100
Received: by svr-svn01.ggp.local (sSMTP sendmail emulation); Tue, 16 Aug 2016 15:33:22 +0100
Date: Tue, 16 Aug 2016 15:33:22 +0100
"Normal" email:
Microsoft Mail Internet Headers Version 2.0
Received: from svr-svn01.ggp.local ([10.0.0.11]) by ggpsystems.co.uk with Microsoft SMTPSVC(6.0.3790.4675);
Tue, 16 Aug 2016 17:14:18 +0100
Received: by svr-svn01.ggp.local (sSMTP sendmail emulation); Tue, 16 Aug 2016 17:14:18 +0100
Date: Tue, 16 Aug 2016 17:14:17 +0100
To: Murray Crane <murray.crane@ggpsystems.co.uk>
From: Mantis Bug Tracker <mantisbt@ggpsystems.co.uk>
Subject: PHPMailer SMTP test
Message-ID: <9fe60fe6fad5511ea613bc431359c86f@svn.ggpsystems.co.uk>
X-Mailer: PHPMailer 5.2.15 (https://github.com/PHPMailer/PHPMailer)
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="b1_9fe60fe6fad5511ea613bc431359c86f"
Content-Transfer-Encoding: 8bit
Return-Path: mantisbt@ggpsystems.co.uk
X-OriginalArrivalTime: 16 Aug 2016 16:14:18.0305 (UTC) FILETIME=[3D8CB310:01D1F7D9]

--b1_9fe60fe6fad5511ea613bc431359c86f
Content-Type: text/plain; charset=us-ascii

--b1_9fe60fe6fad5511ea613bc431359c86f
Content-Type: text/html; charset=us-ascii


--b1_9fe60fe6fad5511ea613bc431359c86f--
It's only happening since upgrading to v1.3.0 (you can see emails from v1.2.19 in the second screenshot), and it's not PHPMailer per se as emails sent with a test script work. I'm going to change up my test script to more closely match what MBT is doing and continue working through this...

EDIT: Don't know how diagnostically useful it is to say this, but everything that I would be expecting to see in the headers on the "blank" email appears at the top of the body. And just while I'm completing the diagnostic info:-

OS: Ubuntu 14.04.5
HTTPD: Apache 2.4.18
PHP: PHP 5.6.23 (Sury's deprecated PPA)
Local MTA: sSMTP 2.64
Smart Hub: Exchange 2003 SP Last (SBS 2003)
Client: Outlook 2003 SP3
DB: MySQL 5.6.31 (Percona Server on separate Ubuntu 14.04.5 install)

Management have decided this morning that we'll roll back our production for now, I'm going to keep this going in testing...
mlcrane
Posts: 27
Joined: 21 Apr 2011, 08:21

Re: Emails arriving partially blank

Post by mlcrane »

Progress (of a kind)! I have succeeded in reproducing the problem in a PHPMailer test script (attached - rename with a '.php' extension), so now I can "play" with that to see if any one value makes things work.
Attachments
test_mail.txt
MantisBT mail test script, does (most) everything MantisBT 1.3.0 does, but in a more manual, hand-crafted way.
(5.84 KiB) Downloaded 316 times
Last edited by mlcrane on 17 Aug 2016, 15:13, edited 1 time in total.
mlcrane
Posts: 27
Joined: 21 Apr 2011, 08:21

Re: Emails arriving partially blank

Post by mlcrane »

It's this stanza in core/email_api.php (in email_send(), c. 1143) that causes me/Exchange 2003/Outlook 2003 all the problems:

Code: Select all

	# Setup new line and encoding to avoid extra new lines with some smtp gateways like sendgrid.net
	$t_mail->LE         = "\r\n";
	$t_mail->Encoding   = 'quoted-printable';
If I remove (comment) those two lines, the emails look as they used to (not that surprising, 1.2.19 doesn't have that stanza or anything like it). Now the real fun (for me) begins - why doesn't Exchange/Outlook render emails correctly when these two are set?

NOTE: If I remove only the LE setting, the emails have all the headers, but I get newline doubling and weird line breaking/additional "=" characters in the body. Wouldn't be surprised if MS used "Unix line breaks" internally in Exchange/Outlook 2003 and never told anyone.
Post Reply