A friend who uses PHPMailer to send an email may encounter garbled characters when carrying a Chinese attachment name. here is a solution. for example, if the attachment we want to send is a test txt file
Attachment ", if you force the method of specifying the file name when adding the attachment:
$ Mail-> AddAttachment ($ attach, $ attach );
The file name of the uploaded attachment will be garbled, if not specified:
$ Mail-> AddAttachment ($ attach, $ attach );
That's why the Chinese characters in the sent file names are too weak to be written into the txt file ".
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 );