Score:0

Multipart text/html email from Invision Community not parsing correctly

jp flag

First of all, yes I have contacted Invision Community support. Yes, I am a paying user with an active license. We went back and forth for several hours and all they have to say is there's nothing wrong with their software, and I need to fix my server.

I'm using CentOS 7.9.2009, PHP 8.0.7, Apache 2.4.6, and Exim 4.94.2.

When Invision Communtiy sends emails the From: value says Apache or Root instead of the name of the forum, and the html part of the email just shows code instead of having a text part and an html part.

I also have php code that I wrote myself using the mail() function on the same server using the same version of php and everything that sends perfect multipart emails.

Comparing the source of an email sent by Invision and an email sent by my code I noticed that the From: header and the Content-Type: headers on the Invision email are indented in by one space, and those same headers on the emails sent by my code don't have any whitespace in front of them. Those headers seem to be ignored by the mail client. Here's what the source looks like:

MIME-Version: 1.0
 From: =?UTF-8?B?SGVsaW9OZXQ=?= <[email protected]>
 Date: Tue, 29 Jun 2021 19:04:36 +0000
 Auto-Submitted: auto-generated
 Content-Type: multipart/alternative; boundary="--==_mimepart_3d7970817fa277e018f1936f5865d582"; charset=UTF-8
 Content-Transfer-Encoding: 8bit
Message-Id: <[email protected]>

Notice the single space in front of From, Date, Auto-Submitted, and Content-Type.

Here's what those headers look like on an email that displays correctly from the same server:

MIME-Version: 1.0
From: "Example" <[email protected]>
List-Unsubscribe: <mailto:[email protected]>, <https://www.example.com/unsubscribe/?c=3d9795e2646d156972cdf58655c758bd
Content-type: multipart/alternative;boundary=helio60db72e0c0005
Message-Id: <[email protected]>
Date: Tue, 29 Jun 2021 19:22:08 +0000
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report

First of all, would these spaces cause the issues I'm seeing?

Second, if the spaces are the issue how do I go about fixing them?

Digging around in Invision's code it looks like they use PHP Pear Mail package https://pear.php.net/package/Mail Obviously it's probably a bad idea to edit Invision's code or Pear's code because any changes would likely be overwritten the next time I update. Are there any server settings I could change to fix this? Let me know if you need additional information and I'll edit in. Thanks!

Michael Hampton avatar
cz flag
The single space at the beginning is called folding white space, and the contents of such lines are considered a continuation of the previous line. Thus that message has ONLY the headers MIME-Version (with a quite bizarre and probably invalid value) and Message-Id. Invision Community certainly does not do this, so the problem indeed is likely elsewhere. Why does this system use Exim? That's a very strange choice and rarely seen outside some niches such as mass web hosting.
Krydos avatar
jp flag
The server is a cPanel server, and cPanel installed Exim.
Michael Hampton avatar
cz flag
Aha. Then your next stop should be cPanel support. We actually do not accept questions about cPanel systems here.
Krydos avatar
jp flag
Oh sorry. I didn't realize that. Thanks!
Paul avatar
cn flag
@Krydos You should close your question, as it is considered off-topic here at Server Fault due to the installation of the web hosting control panel, but please return and ask questions on other topics.
Krydos avatar
jp flag
I solved it myself by editing Invision's code, and it had nothing to do with cPanel. I'm obviously new here, but wouldn't it be better to have an accepted answer rather than deleting it entirely?
Score:1
jp flag

I was able to fix this issue by editing Invision's code and changing one occurrence of PHP_EOL to "\r\n". Hopefully they include my changes in future releases of their software.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.