Home > Backend Development > PHP Tutorial > Specific solutions to sending garbled emails with PHP_PHP Tutorial

Specific solutions to sending garbled emails with PHP_PHP Tutorial

WBOY
Release: 2016-07-15 13:31:55
Original
906 people have browsed it

We have introduced in detail in some previous articles

The following code is an example of a specific solution to garbled emails sent by PHP:

  1. < ?php
  2. # email.php 2009-11-04
  3. $name = $_POST['name' ];
  4. $mail = $_POST['mail'];
  5. $content = $_POST['content'];
  6. $ subject = 'Test only';
  7. $subject = "=?UTF-8?B?".
    base64_encode($subject)."?=";
  8. $body = "From:$mailnName:
    $namennContent:$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. I hope that with this understanding of this code, everyone can avoid the situation where PHP sends garbled emails.


http://www.bkjia.com/PHPjc/446172.html

www.bkjia.com

http: //www.bkjia.com/PHPjc/446172.htmlTechArticleWe have introduced in some previous articles that the following code is a specific solution to garbled emails sent by PHP. Example: ?php #email.php2009-11-04 $ name =$_POST['name'];...
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template