There is such a function for sending messages:
public function send_email($email, $mess) { $subject = 'Проверка работы рассылки'; // mail($email, 'sd', $mess, 'From:'.$from); $headers = "MIME-Version: 1.0\n" ; $headers .= "Content-type: text/html; charset=UTF-8; \r\n"; //$headers .= "From: $from\r\n"; $subject = "=?UTF-8?B?".base64_encode($subject)."?="; @mail($email, $subject, $mess, $headers); } I send messages by inserting into HTML a template with such a header:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- So that mobile will display zoomed in --> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- enable media queries for windows phone 8 --> <meta name="format-detection" content="telephone=no"> <!-- disable auto telephone linking in iOS --> If the word is written in the template, then Russian characters are normally visible, and if I take from the database (there is UTF-8 encoding), then all Russian characters fly to the question marks "????????? ....". I have already tried to set the windows-1251 and CP1251 encoding in the message sending function, nothing has helped.