Home > php教程 > php手册 > PHP发送邮件乱码的具体解决方法

PHP发送邮件乱码的具体解决方法

WBOY
Release: 2016-06-13 11:08:56
Original
746 people have browsed it

我们曾经在前面一些文章中具体介绍了

下面这段代码就是PHP发送邮件乱码的具体解决方法的示例:

  1.  ?php 
  2. #email.php 2009-11-04  
  3. $name = $_POST['name'];  
  4. $mail = $_POST['mail'];  
  5. $content = $_POST['content'];  
  6. $subject = '测试专用';  
  7. $subject = "=?UTF-8?B?".
    base64_encode($subject)."?=";  
  8. $body = "来自:$mailn姓名:
    $namenn内容:$content"
    ;  
  9. $headers = "MIME-Version: 1.0rn";  
  10. $headers .'Content-type: 
    text/html; charset=utf-8'
     . "rn";  
  11. $headers ."Content-
    Transfer-Encoding: 8bitrn"
    ;  
  12. if(mail('*****@qq.com',
    $subject,$body,$header)){  
  13. echo 'success';  
  14. }else{  
  15. echo 'fail';   
  16. }  
  17. ?> 

希望同构对这段代码的了解,大家能避免PHP发送邮件乱码这种情况的出现。


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template