0

My office processes many email receipts from WordPress-based forms (primarily using the Formidable Pro plugin). Starting in the last 6 months, one out of every ~15 emails sent from WP will come through corrupted. Equal signs and broken HTML will appear in the body of the email.

I notice this happens to messages received ONLY by Outlook/Exchange clients. In this case everyone in the office is using Exchange. The same emails CC'd to Gmail or another service do not have the corruption.

The situation is made more confusing and difficult to diagnose by the following details:

  • This doesn't appear to be a problem specific to Formidable Pro. Other plugins that send email via WordPress are also affected.
  • Not every email is affected, Person A's form submission email may come through Exchange fine, Person B's form submission email is corrupted (coming from the same form)-- with seemingly no pattern
  • Mail coming from other non-WordPress applications (such as a ticketing system, a custom PHP form, etc.), on the same web server, using the same SMPT for outgoing mail do not have this problem. This is definitely a problem that involves WP. All other automated emails, internal/external communications via the Exchange server have not experienced any corruption.
  • Our recipients are using the latest version of Exchange server (fully patched)

The only conclusions I can make are that it is some combination of WP Mail, MIME, and Exchange. Below is an attached screenshot and redacted header of a problem email.

Any help on what direction I can take in further diagnosing this issue would be greatly appreciated

Thank you

corrupt email body from wordpress

Received: from smtp.school.edu (XXX.XXX.XXX.XXX) by email.school.edu
 (XXX.XXX.XXX.XXX) with Microsoft SMTP Server id 14.3.266.1; Sun, 15 Nov 2015
 21:15:40 -0600
DKIM-Signature: [v=1; a=rsa-sha1; c=relaxed/relaxed;
  s=s1024; d=school.edu;
  h=subject:to:date:from:message-id:mime-version:content-type;
  bh=XXXXXX;
  b=XXXXXX
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
  s=s1024; d=school.edu;
  h=subject:to:date:from:message-id:mime-version:content-type;
  b=XXXXXX
Received: from WWW1.school.edu ([XXX.XXX.XXX.XXX]) by smtp.school.edu with
 Microsoft SMTPSVC(7.0.6002.18264);  Sun, 15 Nov 2015 21:15:40 -0600
Subject: =?UTF-8?B?TGlicmFyeSAtIFXXXXXgU3VnZ2VzdGlvXXXXXXtaXR0ZWQgb24gTFNVIExXXXXXcm1z?=
To: <webmaster@school.edu>
X-PHP-Originating-Script: 0:class-phpmailer.php
Date: Mon, 16 Nov 2015 03:15:40 +0000
From: School Web <webmaster@school.edu>
Message-ID: <056fdb4d7f0283a31dff135fe202c159@www.school.edu>
X-Priority: 3
X-Mailer: PHPMailer 5.2.10 (https://github.com/PHPMailer/PHPMailer/)
Reply-To: <webmaster@school.edu>
MIME-Version: 1.0
Return-Path: webmaster@school.edu
X-OriginalArrivalTime: 16 Nov 2015 03:15:40.0590 (UTC) FILETIME=[126F9CE0:01D1201D]
X-MS-Exchange-Organization-AuthSource: email.school.edu
X-MS-Exchange-Organization-AuthAs: Anonymous
X-MS-Exchange-Organization-PRD: school.edu
X-MS-Exchange-Organization-SenderIdResult: Pass
Received-SPF: Pass (email.school.edu: domain of webmaster@school.edu
 designates XXX.XXX.XXX.XXX as permitted sender) receiver=email.school.edu;
 client-ip=XXX.XXX.XXX.XXX; helo=smtp.school.edu;
Content-type: multipart/alternative;
    boundary="B_3530511021_187771850"

> This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

--B_3530511021_187771850
Content-type: text/plain;
    charset="UTF-8"
Content-transfer-encoding: 7bit

Affiliation:<=strong> XXXXXX Student 
Comments: 1. I would feel a lot safer if, after a certain tim=, we would have to swipe our IDs to have access into the building. 
<=r/>2. I wish the undergrads did not have access to our classrooms or our l=brary, especially during finals season. 

3. I would appreciate i= if the library would allow us to have the study rooms for more than 3 hou=s IF all of the other study rooms are not full. I don't see the rationale =ehind kicking us out when there is no one else waiting for the room and th=re are 6  other empty ones not being used... 

--B_3530511021_187771850
Content-type: text/html;
    charset="UTF-8"
Content-transfer-encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8">
</head>
<body>
<table cellspacing=3D"0" style=3D"font-size:12px;line-height:135%; border-b=3Dtto=
m:1px solid #dddddd;">
<tbody>
<tr style=3D"background-color:#eeeeee;">
<th style=3D"text-align:left;color:=3D444444;padding:7px 9px;border-top:1px sol=
id #dddddd">
<strong>Affiliation:&lt;=3Dstrong&gt;</strong></th>
<td style=3D"text-align:left;color:#444444;padding:7px 9px;bor=3Der-top:1px sol=
id #dddddd">
XXXXXX Student</td>
</tr>
<tr style=3D"background-color:#ffffff;">
<th style=3D"text-align:left;color:=3D444444;padding:7px 9px;border-top:1px sol=
id #dddddd">
<strong>Comments:</st=3Dong></strong></th>
<td style=3D"text-align:left;color:#444444;padding:7px 9px;border=3Dtop:1px sol=
id #dddddd">
1. I would feel a lot safer if, after a certain tim=3D, we would have to swip=
e our IDs to have access into the building.
<br>
&lt;=3Dr/&gt;2. I wish the undergrads did not have access to our classrooms o=
r our l=3Dbrary, especially during finals season.
<br>
<br>
3. I would appreciate i=3D if the library would allow us to have the study ro=
oms for more than 3 hou=3Ds IF all of the other study rooms are not full. I do=
n't see the rationale =3Dehind kicking us out when there is no one else waitin=
g for the room and th=3Dre are 6
 other empty ones not being used...</td>
</tr>
</tbody>
</table>
</body>
</html>


--B_3530511021_187771850--
0

I run into the same issue and after a research, I found out that this is a bug with class-phpmailer.php. The bug was apparently introduced in WP 4.3.2. Even if the changelog doesn't mention it, the file was modified. Only reverting wp-includes/class-phpmailer.php to the version that was included in WP 4.3.1 fixed the issue.

The class itself also has a version, in this case I reverted to 5.2.10.

By the way, I only saw that issue also with Exchange users. But not all of them reported it.

If you are interested, some users suggest that it is an issue with fixEOL(), but I couldn't make it work by patching it: Few chars getting replaced with '=' in mail content in wp_mail()

  • Thanks Hernan! I haven't seen it happen in awhile and was hoping that one of the recent WP updates fixed the issue. It is so intermittent that I may still have the issue. A bug in the bundled php-mailer makes sense. If I see it happen again I'll try reverting to an older version. – samJL Apr 27 '16 at 20:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.