For example, the attachment we are sending is "test. txt", if you want to force the use of the specified file name when you add the attachment:
$mail->addattachment ($attach, $attach);
Then send the past attachment file name will be garbled, if not specified:
$mail->addattachment ($attach, $attach);
Then send the previous file name in the Chinese simply did not, became a ". txt".
Solutions
Open class.phpmailer.php, in about 1007th line, function addattachment, there is a sentence
The code is as follows |
Copy Code |
$filename = basename ($path); if (false = = = Strpos ($path, '/')) $filename = $this->encodeheader ($path); Else $filename = $this->encodeheader (substr ($path, Strrpos ($path, '/') + 1)); |
Solution II
If you want to set the file name to Chinese, the name parameter (the second argument) in Chinese is provided when AddAttachment is invoked.
Like what
The code is as follows |
Copy Code |
$mail->addattachment (' Temp/2011/test.rar ', ' Test. rar '); |
Other questions: When sending Chinese mail, Chinese will appear garbled
I looked at the source code, garbled generated is probably in the mail heading into a few small =?utf-8? B?...? = When, may be accidentally cut off the Chinese to produce, so my modification is simpler and slightly softer, modify line 1185th:
code is as follows |
copy code |
$maxlen = 75 -7-strlen ($this->charset); Change to: $maxlen = 75000-7-strlen ($this->charset); |