У меня проблемы с отображением PHPMailer и HTML-сущностей в сообщении.
Пример:
Привет, я '
d it '
s Дэвид здесь, бла,бла.
Вот настройка, которую я использую для PHPMailer:
$name = trim(filter_input(INPUT_POST, "name", FILTER_SANITIZE_STRING));
$phone = trim(filter_input(INPUT_POST, "phone", FILTER_SANITIZE_STRING));
$email = trim(filter_input(INPUT_POST, "email", FILTER_SANITIZE_EMAIL));
$message = trim(filter_input(INPUT_POST, "message", FILTER_SANITIZE_SPECIAL_CHARS));
$emailBody = "";
$emailBody .= "Name: " . $name . "\n";
$emailBody .= "Phone: " . $phone . "\n";
$emailBody .= "Email: " . $email . "\n";
$emailBody .= "Message: " . $message . "\n";
$mail = new PHPMailer;
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
$mailer->Host = 'tls://smtp.gmail.com';
$mailer->SMTPAuth = true;
$mailer->SMTPSecure = 'tls';
$mailer->Port = 587;
$mail->Username = "*********@gmail.com";
$mail->Password = "***********";
$mail->CharSet = 'utf-8';
$mail->Encoding = 'base64';
$mail->setFrom('some@example.com');
$mail->addReplyTo($email, $name);
$mail->addAddress('someone@example.com', 'Some One');
$mail->Subject = 'Site Message From: ' . $name;
$mail->Body = $emailBody;
if(!$mail->send()) {
$msg .= "Mailer Error: " . $mail->ErrorInfo;
exit;
}
Любая помощь с этим будет принята с благодарностью:)