function sendMail ($from, $to, $title, $message){
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=\"windows-1251\"\r\n";
$headers .= "From: ".$from."\r\n";
@mail(
mb_convert_encoding($to, 'windows-1251', 'utf-8'),
mb_convert_encoding($title, 'windows-1251', 'utf-8'),
mb_convert_encoding($message, 'windows-1251', 'utf-8'),
mb_convert_encoding($headers, 'windows-1251', 'utf-8')
);
}
sendMail ('from@mail.ru', 'to@mail.ru', 'title','message');