$to = 'pocta@mail.ru';
$subject = "Тема письма";
$subject = '=?utf-8?b?' . base64_encode($subject) . '?=';
$headers = 'From: =?utf-8?B?' . base64_encode($name) . '?= <' . $data['email'] . '>' . PHP_EOL;
$headers .= 'Reply-To: receiver@domain3.com' . PHP_EOL;
$headers .= 'X-Mailer: PHP/' . phpversion() . PHP_EOL;
$headers .= 'Mime-Version: 1.0' . PHP_EOL;
$headers .= 'Content-Type: multipart/alternative; boundary="==boundary-2"' . PHP_EOL.PHP_EOL;
$body = '--==boundary-2' . PHP_EOL.PHP_EOL;
$body .= 'Content-type: text/plain; charset="utf-8"' . PHP_EOL;
$body .= 'Content-Transfer-Encoding: 8bit' . PHP_EOL.PHP_EOL;
$body .= $text . PHP_EOL; //текстовая версия
$body .= '--==boundary-2' . PHP_EOL;
$body .= 'Content-Type: multipart/related; boundary="==boundary-1"; type="text/html"' . PHP_EOL.PHP_EOL;
$body .= '--==boundary-1' . PHP_EOL;
$body .= 'Content-type: text/html; charset="utf-8"' . PHP_EOL;
$body .= 'Content-Transfer-Encoding: base64' . PHP_EOL.PHP_EOL;
$body .= chunk_split(base64_encode($html)) . PHP_EOL.PHP_EOL; //html версия
$body .= '--==boundary-1--' . PHP_EOL;
$body .= '--==boundary-2--' . PHP_EOL;
result "error"
data
0 "Некорректное значение поля «Пол»!"
1 "Некорректное значение поля «Сотрудник»!"