Note that there are some explanatory texts on larger screens.

plurals
  1. POChinese Characters in email sent via PHP not showing up
    text
    copied!<p>I send mail via PHP with Chinese characters from my testing server, and it sends it out perfectly. The encoding is UTF-8. When I upload the same PHP file to another server and try to send e-mail from there, it will look 90% fine in one mail client (web-based mail actually, GMail), but in another mail client (Apple Mail) it's all gibberish - even when I try changing the encoding in the mail client.</p> <p>I'm stuck here, because everything works fine on one server but not another. I'm not sure where to start looking for solutions. What's even more puzzling is that on the production server, the e-mail looks somewhat ok (strange case of some characters not showing), but in other mail apps it looks like garbage.</p> <p>Any idea where I can start looking to solve this?</p> <p><b>PHP</b></p> <pre><code>$books = json_decode ($_POST['books']); $body = ' &lt;body bgcolor="#999999"&gt;&lt;center&gt; &lt;table width="700" border="0" cellspacing="2" cellpadding="10" bgcolor="#FFFFFF"&gt; &lt;tr&gt; &lt;td&gt; 你好 ' . $_POST['name'] . ',&lt;br/&gt;&lt;br/&gt;以下是你从学习网站,给孩子讲故事课程,所要求的书籍名单&lt;br/&gt;&lt;br/&gt;&lt;hr noshade="noshade" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;'; $iLen = count($books); for ($i = 0; $i &lt; $iLen; $i = $i + 1) { $book = $books[$i]; $body .= '&lt;b&gt;' . $book-&gt;title . '&lt;/b&gt;&lt;br/&gt;' . $book-&gt;author . '&lt;br/&gt;&lt;br/&gt;'; $body .= '简介: ' . $book-&gt;synopsis . '&lt;br/&gt;'; $body .= '年龄层: ' . $book-&gt;age . '&lt;br/&gt;'; $body .= '场景: ' . $book-&gt;setting . '&lt;br/&gt;'; $body .= '目的: ' . $book-&gt;purpose . '&lt;br/&gt;'; $body .= '索书号: ' . $book-&gt;call . '&lt;br/&gt;&lt;br/&gt;'; $body .= '出版商: ' . $book-&gt;publisher . '&lt;br/&gt;&lt;br/&gt;&lt;hr noshade="noshade" /&gt;'; } $body .= ' &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 亲切问侯,&lt;br/&gt;Name &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/center&gt; &lt;/body&gt; '; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; $headers .= 'From: Name &lt;no-reply@here.com&gt;' . "\r\n"; $ok = mail ($_POST['email'], '讲故事给孩子听:您所要求的故事精选书单', $body, $headers); </code></pre> <p><b>Result</b></p> <pre><code>ä∏ å¥∏ ryan, ä»¥ä¸—æ˘¯ä∏ ä»⁄å–œä’ ç∏Œç«˙,ç»˙å–©å–∆è®”æ∑亗è¯≤稗,æ≈•蜙æ±≠ç˚≥䒜籟å∆ŸåŸ 瑲瑲æ√Œæ˛≈å¤˚ç√±ä∏ 麜å∑—å¸∞é˝·å°π, å±±å§∫ Synopsis: 粗å∂¯ç√±ç˚≥å°∂å∑‰å®ˇå®ˇæ•⁄ä’√牨å®∞ç—¬ç≈’ç˚≥戒åπ∂å‚‘å∑‰åœ√åœ√说å®∞æ˛≈å¤˚ç√±å®∞ã•≠ Age Group: 4 - 6 å”™ Setting: ç≤¤ä∏„ Purpose: ä»·å•πè§≠å‚‘ä¿∞è¿˝äº”å–∆ç˚≥æ≥ƒæ∞∑ Call no: JP MAC Publisher: 麜å∑—å¸∞é˝·å°π, å±±å§∫. 瑲瑲æ√Œæ˛≈å¤˚ç√±ä∏ .丅海 : 尌咴å≥¿ç«¥åΩºç≈√ç¤≤, 2005. </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload