The Chinese attachment name of the PHPMailer email is garbled

Source: Internet
Author: User
When quot;, if you force the specified file name when adding an attachment... A friend who uses PHPMailer to send an email may encounter garbled characters when carrying the Chinese attachment name. next I will introduce a solution. for example, the attachment we want to send is "test .txt ", if you force the specified file name when adding an attachment:

$ Mail-> AddAttachment ($ attach, $ attach );

The file name of the uploaded attachment will be garbled, if not specified:

$ Mail-> AddAttachment ($ attach, $ attach );

Then, the Chinese characters in the file name sent in the past are gone and become ". txt ".

Solution: If you want to set the file name to Chinese, provide the Chinese name parameter (the second parameter) when calling AddAttachment. for example, the code is as follows:

$ Mail-> AddAttachment ('temp/2011/test.rar ', 'Test .rar ');

Other questions: when sending a Chinese email, garbled characters may occur in Chinese. I checked the source code. the garbled characters are generated by converting the Mail title into several smaller ones =? UTF-8? B ?...? =, It may have accidentally truncated the Chinese characters, so my modifications are simpler and a little gentle. modify the 1,185th rows:

$ Maxlen = 75-7-strlen ($ this-> CharSet); changed:

$ Maxlen = 75000-7-strlen ($ this-> CharSet );


Address:

Reprinted at will, but please attach the article address :-)

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.