All the good time!
When everything was in windows-1251, everything worked fine. The hieroglyphs in the letter appeared after translating everything to utf-8.
Script codes in utf-8, in html head meta http-equiv = "Content-Type" content = "text / html; charset = utf-8".
Similar topics googled, nothing has helped yet. To use the Latin in the From field not to offer, because need cyrillic.
When a letter arrives in the mail, then in the general list of letters, in the field from whom, the Cyrillic alphabet is displayed correctly . When you enter the letter itself, the same text in the field from whom , only Latin letters and the sender's e-mail are correctly displayed, Cyrillic characters are displayed . In bold there is something that is confusing, everything is fine in the general list, it means that I am sending everything correctly, but why does everything change in the letter itself?
Also tried the options:

'subject' = '=?koi8-r?B?'.base64_encode(convert_cyr_string("НовоС сообщСниС", "w","k")).'?='; 'subject' = '=?utf-8?B?'.base64_encode(convert_cyr_string("НовоС сообщСниС", "w","k")).'?='; 'subject' = '=?koi8-r?B?'.base64_encode("НовоС сообщСниС").'?='; 'subject' = '=?utf-8?B?'.base64_encode("НовоС сообщСниС").'?='; 

On From no effect.

Php code:

 <php $mail = array( 'to' => "tomail@site.ru", 'subject' => "НовоС сообщСниС", 'message' => "<html><body><p>ВСкст сообщСния</p></body></html>", 'headers' => "MIME-Version: 1.0\r\n"."Content-type: text/html; charset=utf-8\r\n"."From: Π­Ρ‚Π° ΠΊΠΈΡ€ΠΈΠ»Π»ΠΈΡ†Π° выводится ΠΈΠ΅Ρ€ΠΎΠ³Π»ΠΈΡ„Π°ΠΌΠΈ <frommail@site.ru>\r\n"); mail($mail['to'], $mail['subject'], $mail['message'], $mail['headers']); 
  • convert_cyr_string does not work with utf8 - Stuf
  • Try this: <? Php function mail_utf8 ($ to, $ subject = '(No subject)', $ message = '', $ from) {$ header = 'MIME-Version: 1.0'. "\ n". 'Content-type: text / plain; charset = UTF-8 '. "\ n". 'From: Yourname <'. $ from. "> \ n"; mail ($ to, '=? UTF-8? B?'. base64_encode ($ subject). '? =', $ message, $ header); } mail_utf8 ('xxx@xxx.xx', 'Subject', 'Message', 'Title'); ?> The function sends utf-8, but, of course, you need to finish it for your purposes. - Stuf
  • Or, alternatively, since everything worked for you in win1251, then use it as well, convert only all the data from the code)) $ subject = iconv ('utf-8', 'windows-1251', $ subject); - Stuf
  • @ananas once it worked, I'll arrange it as the answer) - Stuf
  • @Stuf I wrote that the last comment was not the answer , he just pushed the answer. There is no need to code subject. You only need iconv () to apply to the header, as in my comments. Correct the answer so that the one who will use does not run across the same rake. - ananas

1 answer 1

Thanks Stuf , the last comment pushed for an answer.
Substitutions in the subject did not help, but the conversion only the header decided everything. Decided as follows:

 <?php $mail = array( 'to' => "tomail@site.ru", 'subject' => "НовоС сообщСниС", 'message' => "<html><body><p>ВСкст сообщСния</p></body></html>", 'headers' => "MIME-Version: 1.0\r\n"."Content-type: text/html; charset=utf-8\r\n"."From: Π­Ρ‚Π° ΠΊΠΈΡ€ΠΈΠ»Π»ΠΈΡ†Π° выводится ΠΈΠ΅Ρ€ΠΎΠ³Π»ΠΈΡ„Π°ΠΌΠΈ <frommail@site.ru>\r\n"); mail($mail['to'], $mail['subject'], $mail['message'], iconv ('utf-8', 'windows-1251', $mail['headers']));