PhpMailer Chinese garbled questions

Source: Internet
Author: User
PhpMailer Chinese garbled problem I used phpmailer class library to send an email, encoding has been set to UTF-8, but if the sender, recipient, and subject contains Chinese characters, it will show garbled problem, very uncomfortable. I found some methods from the internet. they are modifying the class. phpmailer. php file. Because I don't want to modify it, I want to ask someone else for advice .. Thank you ., C/C ++ phpMailer Chinese garbled problem
I want to send an email using the phpmailer class library. the encoding has been set to utf-8. However, if the sender, recipient, and topic contain Chinese characters, it will be garbled and uncomfortable. I found some methods from the internet. they are modifying the class. phpmailer. php file. Because I don't want to modify it, I want to ask someone else for advice .. Thank you.

------ Solution --------------------
C/C ++ code
I tried it and succeeded. I just picked it and entered it on the code website. The title and content are not garbled. Is the main php file windows or linux? Note that the encoding of the PHP file is the same as that set by mailer. The latest phpmailer and 163 are sent to QQ.
  CharSet = "UTF-8"; // Set the mail encoding, the default ISO-8859-1, this must be set if you send Chinese, otherwise garbled $ mail-> IsSMTP (); // Set the SMTP Service $ mail-> SMTPDebug = 1; // enable SMTP debugging // 1 = errors and messages // 2 = messages only $ mail-> SMTPAuth = true; // enable the SMTP verification function $ mail-> Host = "smtp.163.com"; // SMTP server $ mail-> Port = 25; // SMTP server port $ mail-> Username = "abcdii"; // SMTP server Username $ mail-> Password = "xxxx "; // SMTP server password $ mail-> SetFrom ('abcdii @ 163.com ', 'L Iangdong '); $ mail-> AddReplyTo ("abcdii@163.com", "liangdong"); $ mail-> Subject = $ subject; $ mail-> AltBody = "To view the message, please use an HTML compatible email viewer! -From www.jiucool.com "; // optional, comment out and test $ mail-> MsgHTML ($ body); $ address = $ to; $ mail-> AddAddress ($ address, "liangdong"); // $ mail-> AddAttachment ("images/phpmailer.gif"); // attachment // $ mail-> AddAttachment ("images/phpmailer_mini.gif "); // attachment if (! $ Mail-> Send () {echo "Mailer Error:". $ mail-> ErrorInfo;} else {echo "Message sent! Congratulations, the email is sent successfully! ";}} Postmail_jiucool_com ('2017 @ qq.com ',' I am Liangdong ', 'Hi');?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.