Here, I will solve a problem that many people may have encountered and are confused and do not know how to do it. How can I send a Chinese email without garbled characters? Here I will show you how to send a Chinese email in UTF-8 encoding format. This document does not contain Chinese emails in GBK or GB2312 encoding format. It is actually very easy to solve this problem. Please read the following generation
Here, I will solve a problem that many people may have encountered and are confused and do not know how to do it. How can I send a Chinese email without garbled characters? Here I will show you how to send a Chinese email in UTF-8 encoding format. This document does not contain Chinese emails in GBK or GB2312 encoding format. It is actually very easy to solve this problem. Please read the following generation
Here, I will solve a problem that many people may have encountered and are confused and do not know how to do it.
How can I send a Chinese email without garbled characters?
Here I will show you how to send a Chinese email in UTF-8 encoding format. This document does not contain Chinese emails in GBK or GB2312 encoding format.
It is actually very easy to solve this problem. Read the following code. Reference your email title as '=? UTF-8? B? 'And '? = '.
You can use HTML to edit your email content, but do not forget to use UTF-8 encoding.
Email Header content
MIME-Version: 1.0MIME Version. This header field uses a Version number to indicate the MIME-compliant Version of a message in the message. The current version is 1.0.
Content-Type: text/html; charset = UTF-8; supports HTML format, UTF-8 encoding.
Content-Transfer-Encoding: 8Bit
Content transmission code, which is an 8-bit ASCII code.
X-Mailer: LixiPHP
The system name of the email you want to send.
From: =? UTF-8? B? What is the sender's name? =
Email address sent
To: =? UTF-8? B? Recipient's name? =
Accepted email address
Subject: =? UTF-8? B? Mail title? = Mail title
By viewing the source code of the email, I can see:
PHP Mail Code
Public function send_email ($ to, $ from, $ subject, $ message, $ fromname = ", $ toname = "){
If ($ toname ){
$ To = '=? UTF-8? B? '. Base64_encode ($ toname ).'? = '. $;
}
If ($ fromname ){
$ From = '=? UTF-8? B? '. Base64_encode ($ fromname ).'? = '. $ From;
}
$ Headers = 'from: '. $ From. "\ r \ n ".
"MIME-Version: 1.0 \ r \ n ".
"Content-Type: text/html; charset = UTF-8; format = flowed \ r \ n ".
"Content-Transfer-Encoding: 8Bit \ r \ n ".
'X-Mailer: PHP/'. phpversion ();
$ Subject = '=? UTF-8? B? '. Base64_encode ($ subject ).'? = ';
// Send email
Mail ($ to, $ subject, $ message, $ headers );
}
This is a simple UTF-8 mail sending function, it is the header information in the Chinese through encryption to solve the problem of Chinese garbled.
(...)
Read the rest of solve PHP mail Send UTF-8 Chinese mail garbled (3 words)
©Lixiphp for LixiPHP, 2013. | Permalink | No comment | Add to del. icio. us
Post tags: mail, PHP, UTF8
Feed enhanced by Better Feed from Ozh