-
Notifications
You must be signed in to change notification settings - Fork 273
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
UTF-8 texts are received and displayed incorrectly #96
Comments
If you use php mailer, I suggest this on dev environment: |
Yes, I use PHPMailer as part of "vanilla" WordPress. Default encoding is 8bit. Quoted-printable works. Still, I'm surprised it does not work with default settings. |
Confirm this problem. <?php
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'From: [email protected]' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$message = '<h3>Lorem ipsum ภาษาไทย</h3>';
$message .= '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer convallis leo ut sollicitudin commodo. Nullam accumsan libero ut justo vestibulum porta. Nulla mi lectus, ornare eu laoreet nec, tincidunt pretium risus. Maecenas commodo, ipsum at consectetur malesuada, lectus dui feugiat augue, eu sollicitudin metus lorem at neque. Proin hendrerit, enim quis consectetur laoreet, mauris enim efficitur risus, vel ullamcorper dolor turpis sit amet sapien. Mauris vel orci eu leo mollis laoreet non eget magna. Nunc sed pulvinar metus, vel placerat massa. Aenean arcu mauris, elementum nec rutrum nec, scelerisque in nisl. Proin tempor, ante egestas semper rutrum, ante ligula dapibus lectus, eu sollicitudin augue quam sit amet arcu. Proin id ornare enim. Sed tincidunt lobortis mi non condimentum. Interdum et malesuada fames ac ante ipsum primis in faucibus. Integer sed ligula magna. Aenean a aliquet justo.</p>';
$message .= '<p>Phasellus dui tellus, tempor ut sollicitudin at, laoreet sed enim. Suspendisse justo lectus, pretium eu orci eu, condimentum iaculis turpis. Sed lobortis placerat justo, vel porta mauris fringilla ut. Aliquam erat volutpat. Maecenas at quam non elit auctor tempus. Nulla accumsan lobortis dui, vitae vulputate justo hendrerit a. Aenean in purus lacus. Phasellus sit amet egestas nisl. Curabitur non sapien sem. Duis posuere risus mauris, ac aliquam nibh congue volutpat. Maecenas gravida euismod mi, id fermentum magna vehicula molestie. Nunc rutrum augue id elit tempus ultrices. Nullam aliquet dolor enim, luctus pretium leo blandit eget. Proin placerat eros vitae libero porttitor, vel aliquam felis varius. Aenean neque mauris, hendrerit id purus elementum, maximus faucibus leo. Praesent ut felis vel lectus consequat posuere nec eu massa.</p>';
$message .= '<img src="https://i.imgur.com/aP3KVeX.jpg" alt="" width="700">';
$message .= '<table width="100%">
<tr>
<td style="padding: 5px; vertical-align: top;">
<p>Quisque eu purus vulputate, facilisis ex sit amet, faucibus nisi. Ut sed justo velit. Nulla nec scelerisque nulla. Donec sem turpis, placerat in gravida vitae, fermentum ac enim. Cras in mi tempor, malesuada velit volutpat, gravida mi. Sed varius felis a magna rutrum, ac congue nulla eleifend. Vivamus ut diam sed est consequat molestie aliquam eu nulla. Proin bibendum maximus nulla. Proin molestie, arcu a elementum commodo, odio nisi ultricies orci, suscipit lacinia justo orci at ligula. Phasellus libero mauris, porta quis diam vel, eleifend imperdiet arcu. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla consectetur efficitur massa ac sagittis. Donec sit amet bibendum felis. Donec risus mauris, ornare eget nunc vel, consequat venenatis dui. Donec nisl neque, elementum vel ex vitae, convallis pellentesque magna. Suspendisse id dolor ut orci finibus luctus.</p>
<p>Aenean vel velit augue. Donec id velit in elit iaculis pharetra et id ipsum. Donec id lobortis velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed sed nisi bibendum, ultricies quam a, consequat tellus. Vestibulum sit amet velit eu justo lacinia interdum. Quisque gravida orci sit amet ultricies vulputate. Nunc sed sodales nisi, at bibendum neque. Nam consequat scelerisque ipsum, eu maximus urna. Etiam lectus libero, pulvinar eget hendrerit at, fringilla at nunc. Etiam aliquam purus vitae est sollicitudin, et sagittis dui tincidunt.</p>
</td>
<td style="padding: 5px; vertical-align: top;">Ut eget consequat enim. Nulla non cursus risus, eget dapibus ipsum. Curabitur porttitor ultricies tellus, euismod ornare sem interdum id. Sed luctus augue ut mi molestie, vitae interdum dolor vehicula. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut porta, massa vitae iaculis accumsan, sapien sem ullamcorper velit, sed accumsan nunc massa ac ante. Vivamus blandit ut tortor vel mollis. Curabitur at sodales odio. Proin et ante eu magna vestibulum tincidunt non in metus. Nulla facilisi.</td>
</tr>
</table>';
$result = mail('[email protected]', 'Using Papercut to capture email!', $message, $headers);
var_dump($result); The first line should displaying Lorem ipsum ภาษาไทย. But it is currently displaying Lorem ipsum ??????? (please look at blue highlight in the content. |
8bit only works when the SMTP server supports sending the Session.UseUtf8 = anyEncoding.Contains("8BITMIME") || anyEncoding.Contains("SMTPUTF8");
Connection.Encoding = Session.UseUtf8 ? Encoding.UTF8 : Encoding.ASCII; The PHP SMTP client on Windows doesn't support this. My mails are mostly ASCII and knowing that when the code is deployed to a Linux server, it works, it's not a big priority for me. However, for mails that are mostly non-ASCII, like ภาษาไทย., this is a big problem. I see two solutions to this:
|
Could you use "Base64" or "Quoted-printable" as content transfer encoding? Both of them work. |
Unfortunately, I am using Drupal, which forces the use of CTE=8bit. |
As this is a development SMTP server I don't want to change any settings used for production setup. Which used encoding is and works fine on production. |
Aloha! I'm ScissorBot ✂️ -- the bot in charge of keeping the issues tidy. It looks like this issue is stale due to lack of activity. Unfortunately, I'll be closing it if there is no further activity. 😞 Please contribute to the issue to keep it open. Thanks! |
This is still an issue. |
I am using Windows 10 environment and my php mail() function with all utf-8 headers , as well as html body code is there but papercut still shows turkish characters in utf-8 charset as "??????????". The same script shows correct characters when I test on Mailslurper which is another stmp simulator on my computer. Any workaround this ? |
Should have a fix for this soon. |
Fixed in latest dev. |
How to download Papercut 6.0 ? I cant see Cyrillic text in 5.5.1. |
@necromind Please open a new issue if you are still having problems. Note that this will NOT change emails that have already been received. Verify that you cannot see Cyrillic text on NEW emails. |
Sample email as received and saved by Papercut:
https://www.dropbox.com/s/wn7o2lpx3tnpb77/20180223123256925-000e8a.eml?dl=0
Generated by PHP Nette Framework backend.
And here is how it looks when sent on server (Mailgun service) to Gmail:
https://www.dropbox.com/s/bh5yg6lks7wbg5l/original_msg.eml?dl=0 (removed irrelevant server headers)
Papercut v5.1.3, Windows 10 x64
The text was updated successfully, but these errors were encountered: