php邮件特殊字符utf8 [英] php mail special characters utf8
本文介绍了php邮件特殊字符utf8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下脚本:
<?php
$subject = "Testmail — Special Characters";
$msg = "Hi there,\n\nthis isn’t something easy.\n\nI haven’t thought that it’s that complicated!";
mail($to,$subject,$msg,$from."\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n");
?>
在电子邮件中:
主题: Testmail?特殊字符
正文:
Hi there,
this isn?t something easy.
I haven?t thought that it?s that complicated!
我尝试了很多东西,但我没有任何想法。
你可以帮我吗?你有没有这个工作?
I tried a lot of things, but I have no ideas anymore. Can you help me? Did you ever got this working?
THX!
推荐答案
您尝试 iconv_set_encoding ?
这应该工作:
<?php
iconv_set_encoding("internal_encoding", "UTF-8");
$subject = "Testmail — Special Characters";
$msg = "Hi there,\n\nthis isn’t something easy.\n\nI haven’t thought that it’s that complicated!";
mail(utf8_decode($to), utf8_decode($subject), utf8_decode($msg), utf8_decode($from)."\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n");?>
这篇关于php邮件特殊字符utf8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文