<?PHP function decodeURIComponent($str) { $str = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($str)); return html_entity_decode($str,null,'UTF-8');; } function SendMail($Charset,$FromName,$FromEmail,$ToName,$ToEmail,$Subject,$Message){ // mb_language("Ru"); // optional mb_internal_encoding($Charset); $From = mb_encode_mimeheader($FromName) . " <" . $FromEmail . ">"; $To = mb_encode_mimeheader($ToName) . " <" . $ToEmail . ">"; $Headers = "From: " . $From . "\r\n"; $Headers .= 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/plain; charset='.$Charset.'' . "\r\n"; // mb_send_mail($To, "=?".$Charset."?B?".base64_encode($Subject)."?=", $Message, $Headers); mb_send_mail($To, $Subject, $Message, $Headers); } if(isset($_POST['MessageSucesSended'])){ SendMail('UTF-8',decodeURIComponent($_POST['FromName']),decodeURIComponent($_POST['FromEmail']),decodeURIComponent($_POST['ToName']),decodeURIComponent($_POST['ToEmail']),decodeURIComponent($_POST['Subject']),decodeURIComponent($_POST['Message'])); echo decodeURIComponent($_POST['MessageSucesSended']); } else { echo false; } ?> |