Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emails received garbled after upgraded php to 8.1 and PHPMailer from 6.0.8 to 6.8 #2942

Closed
sonhoangnz opened this issue Aug 10, 2023 · 1 comment

Comments

@sonhoangnz
Copy link

sonhoangnz commented Aug 10, 2023

Hello,

We just updated our app, php from 7.2 to 8.1 and PHPMailer from 6.0.8 to 6.8
Emails were sent and received fine for most users. However, there is only one client email app Outlook - email content was garbled

I compare email headers before/after upgrade for the affected client

Old email header

...
x-mailer: PHPMailer 6.0.7 https://github.com/PHPMailer/PHPMailer
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0

This is a multi-part message in MIME format.
--b1_HRK3Q97IZYLLSohrkD2PhLxFzZwa4h8wKQD1cKrzc
Content-Type: text/plain; charset=3Dus-ascii

Body content ....
...

New email header (after the upgrades)

....
x-mailer: PHPMailer 6.8.0 https://github.com/PHPMailer/PHPMailer
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0

o=95=E5=C5N=99=93=84=F06QLx=B0=B3=AE=05>=B6=B9=04=18=C9W=C8!=99=EF6=80=A8=
=9E=D7=A7=B5<=A9z=D7=B1=B7=FAej)=DC=85=AA=ECz=B1=AB=1C=8A$^=AA=E7=AC=B4=DA8=
...

It can be seen that the whole session below is missing from the new email header:

This is a multi-part message in MIME format.
--b1_HRK3Q97IZYLLSohrkD2PhLxFzZwa4h8wKQD1cKrzc
Content-Type: text/plain; charset=3Dus-ascii

Also the body is encoded with strange chars. Therefore, email body was garbled

Furthermore, I checked the email headers in Thunderbird before and after upgrade - the content was displayed correctly:

Before the upgrade

X-Mailer: PHPMailer 6.0.7 (https://github.com/PHPMailer/PHPMailer)
...  <- Some extra header here
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="b1_HWANsRj89baCQksHkr6ZVtYYfJ2179c7ShAX06vuaI"
Content-Transfer-Encoding: 8bit

This is a multi-part message in MIME format.
--b1_HWANsRj89baCQksHkr6ZVtYYfJ2179c7ShAX06vuaI
Content-Type: text/plain; charset=us-ascii

After the upgrade

X-Mailer: PHPMailer 6.8.0 (https://github.com/PHPMailer/PHPMailer)
...  <- Some extra header here
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="b1=_FVXduDlLl9VYPEQSxdKR4ZCdwOJvJYCe8Aw2SBM"
Content-Transfer-Encoding: 8bit
...
  <- A empty line here
--b1=_FVXduDlLl9VYPEQSxdKR4ZCdwOJvJYCe8Aw2SBM
Content-Type: text/plain; charset=us-ascii

I knew that the text This is a multi-part message in MIME format was removed from 6.8 as mentioned in #2938. However, I do not know why there is no boundary value for the outlook client. Could you please help

@Synchro
Copy link
Member

Synchro commented Aug 10, 2023

Since you're only seeing this for one recipient, the thing to double-check is that the message they receive is the same as the one you sent. So send them a message and BCC it to yourself, then get an exact copy of what they received, and compare the two. They should be identical (apart from received headers). If there is a difference (like that missing section), you know it's happening somewhere in the mail chain between your script and their inbox.

@PHPMailer PHPMailer deleted a comment Nov 23, 2023
@Synchro Synchro closed this as completed Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants