Recently I ran into a problem, when sending gMail messages (and others too), could not correctly display my letter written by Cyrillic. Climbed on the Internet, there this question has already been raised, and a solution was proposed. After reworking it for myself, I decided to put it here too. I think that some of you may find it useful too:
// The trim function removes spaces at the beginning and end $ title = htmlspecialchars (trim ($ _ POST ['title'])); $ mess = htmlspecialchars (trim ($ _ POST ['mess'));
// Conversion $ title = '=? koi8-r? B?'. base64_encode (convert_cyr_string $ title, "w", "k")). '? ='; $ to = 'some_main@gmail.com'; $ head = "Content-Type: text / plain; \ r \ n"; $ head. = "X-Mailer: PHP /". phpversion (). "\ r \ n"; $ head. = "Reply-To: admin@gmail.com \ r \ n"; $ head. = "To: $ name <$ to> \ r \ n"; $ head. = "From: admin@gmail.com \ r \ n"; $ head. = "Subject: $ title \ n"; ')
// send mail ($ to, $ title, $ mess, $ header);