Home >Backend Development >PHP Tutorial >The ultimate solution to the problem of garbled title, sender, and content of emails sent and received with PHPMailer
is an additional parameter defined for this function. Naturally, you need to modify the parameters of all places where this function is called. Find: EncodeHeader( Change something like this:
Change become:
means to define the third reference as 1, so that the judgment statement in the function we changed can be called. Changed this, of course you have to remember to set CharSet=UTF8 when calling this class. In this way, this judgment statement can be converted to UTF8 without being garbled. It can be written like this:
Second: Fix the garbled email title Subject is to process the email title, you need to find this place correctly. Like mine is called like this
So, like this, change it to this:
is also transcoding ah. Third: Fix garbled characters in other places The basic principle is the same as the second repair. FromName handles the sender. Where to find the sender's name: Mine is written like this:
If you can solve the above three places, the garbled code problem when Phpmailer sends Chinese emails can basically be solved. Attached is a modified and complete example code for sending emails via phpmailer: http://file.jbxue.com/code/201304/phpmailer_lyb_jbxue.com.zip. |