免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3006 | 回复: 3
打印 上一主题 下一主题

PHP发送邮件,解决乱码 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-06-11 14:57 |只看该作者 |倒序浏览
PHP发送邮件,解决乱码
  1. <?php  

  2.      $to = "429517385@qq.com";   

  3.       $date = date("Y年m月d日");   

  4.      $header  = 'MIME-Version: 1.0' . "\r\n";   

  5. $header .= 'Content-type: text/html; charset=utf-8' . "\r\n";

  6.    $header .= "To: $to \r\n";    $header .= 'From: 624159864@qq.com' . "\r\n";   

  7.     $mailsubject  = "=?UTF-8?B?".base64_encode($mailsubject)."?=";

  8. $mailsubject  = "绿尔雅减肥茶订单";  

  9. $user = $_POST['name'];

  10. $qq = $_POST['email'];

  11. $shouji = $_POST['shouji'];

  12. $number = $_POST['number'];

  13. $address = $_POST['address'];

  14. $contents = $_POST['content'];   

  15. $content = '客户'."$user".'<br />';   

  16. $content .= '<br />';     

  17. $content .= '订购了'."$number!".'<br />';   

  18. $content .= '联系电话:'."$shouji".'<br />';  

  19. $content .= '联系QQ:'."$qq".'<br />';

  20.   $content .= '收货地址:'."$address".'<br />';

  21. $content .= '客户留言:'."$contents".'<br />';   

  22.     $content .= "$date".'<br />';  

  23. ini_set("mbstring.language", "Neutral");

  24. ini_set("mbstring.internal_encoding", "UTF-8");

  25. ini_set("mbstring.http_input", "UTF-8");

  26. ini_set("mbstring.http_output", "UTF-8");

  27. ini_set("mbstring.encoding_translation", "On");

  28. ini_set("mbstring.detect_order", "auto");

  29. ini_set("mbstring.substitute_character", "long");   

  30. $result = mail($to, $mailsubject, $content, $headers);      

  31. if($result)    {        echo '订购成功!';    }

  32. ?>
复制代码

论坛徽章:
0
2 [报告]
发表于 2011-06-11 23:06 |只看该作者
火速围观!牛人招PHP技术员-出得厅堂,下得厨房,进得洞房!有木有!!有木有!!

http://bbs.phpchina.com/thread-214382-1-1.html   这公司太有才了,做PHP的还要求会武功,找金庸大师学学吧,笑死俺了哈

论坛徽章:
0
3 [报告]
发表于 2011-06-12 16:24 |只看该作者
火速围观!牛人招PHP技术员-出得厅堂,下得厨房,进得洞房!有木有!!有木有!!

http://bbs.phpchina.com/thread-214382-1-1.html   这公司太有才了,做PHP的还要求会武功,找金庸大师学学吧,笑死俺了哈

论坛徽章:
0
4 [报告]
发表于 2011-06-12 21:22 |只看该作者
private function alarmMail($table,$title)
        {
                $subject = stripslashes($title);
                $subject = "=?UTF-8?B?".base64_encode($subject)."?=";
                $message = "<html><head><title>{$title}</title></head><body>$table</body></html>";
                $from = '';
                $to = '';
                $headers  = 'MIME-Version: 1.0'.PHP_EOL;
                $headers .= "Content-type: text/html; charset=utf-8".PHP_EOL;
                $headers .= "From: $from";
                mail($to,$subject,$message,$headers);
        }
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP