почему не работает??
require 'PhpMailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
$site_mail = "admin@lol.com";
if(empty($_POST["subject"])
|| empty($_POST["user_mail"])) {
http_response_code(400);
}
$backMail = htmlspecialchars($_POST["user_mail"]);
$subject = htmlspecialchars($_POST["subject"]);
$mail->From = $site_mail;
$mail->FromName = $backMail;
$mail->addAddress($site_mail, $subject); // Add a recipient
$mail->addReplyTo('no-reply');
// $html = "<html><head></head> <body>" ;
$html = "Email пользователь:<a href='mailto:{$backMail}'> {$backMail}</a>";
if($_POST["message-text"]) {
$messageText = htmlspecialchars($_POST["message-text"]);
$html .= "<p>Сообщение пользоавателя: </p>" .$messageText;
}
// $html .= "</body></html>";
$mail->Subject = $subject;
$mail->Body = $html;
$mail->isHTML(true);
$mail->CharSet = 'UTF-8';
if(count($_FILES) > 0) {
foreach ($_FILES as $name => $file) {
if(!$file["size"]) continue;
$mail->addAttachment($file["tmp_name"], $file["name"]);
}
}
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
exit;
}
echo 'Message has been sent';