Здравствуйте!
Выдает ошибку - Invalid address: (From): root@localhost:
<?php
$msg = "";
use PHPMailer\PHPMailer\PHPMailer;
include_once "PHPMailer/PHPMailer.php";
include_once "PHPMailer/Exception.php";
include_once "PHPMailer/SMTP.php";
if (isset($_POST['submit'])) {
$email = $_POST['email'];
$fio = $_POST['fio'];
$phone = $_POST['phone'];
$series = $_POST['series'];
$date = $_POST['date'];
if (isset($_FILES['attachment']['name']) && $_FILES['attachment']['name'] != "") {
$file = "uploads/" . basename($_FILES['attachment']['name']);
move_uploaded_file($_FILES['attachment']['tmp_name'], $file);
} else
$file = "";
$mail = new PHPMailer();
//if we want to send via SMTP
$mail->Host = "smtp.timeweb.ru";
$mail->isSMTP();
$mail->SMTPAuth = true;
$mail->Username = "xxxxxxxxx";
$mail->Password = "xxxxxx";
$mail->SMTPSecure = "ssl";
$mail->Port = 465;
$mail->addAddress('xxxxxxxxx');
$mail->setFrom($email);
$mail->Subject = "Заявка с сайта";
$mail->isHTML(true);
$mail->Body = "
<table style='width:100%;'>
<tbody>
<tr style='background-color:#f8f8f8;'>
<td style='padding:10px;border:#e9e9e9 1px solid;'><b>Фамилия, имя и отчество</b></td>
<td style='padding:10px;border:#e9e9e9 1px solid;'>$fio</td>
</tr>
<tr style='background-color:#f8f8f8;'>
<td style='padding:10px;border:#e9e9e9 1px solid;'><b>Телефон</b></td>
<td style='padding:10px;border:#e9e9e9 1px solid;'>$phone</td>
</tr>
<tr style='background-color:#f8f8f8;'>
<td style='padding:10px;border:#e9e9e9 1px solid;'><b>Серия и номер паспорта</b></td>
<td style='padding:10px;border:#e9e9e9 1px solid;'>$series</td>
</tr>
<tr style='background-color:#f8f8f8;'>
<td style='padding:10px;border:#e9e9e9 1px solid;'><b>Дата рождения</b></td>
<td style='padding:10px;border:#e9e9e9 1px solid;'>$date</td>
</tr>
<tr style='background-color:#f8f8f8;'>
<td style='padding:10px;border:#e9e9e9 1px solid;'><b>E-mail</b></td>
<td style='padding:10px;border:#e9e9e9 1px solid;'>$email</td>
</tr>
</tbody>
</table>
";
$mail->addAttachment($file);
$mail->CharSet = "UTF-8";
if ($mail->send())
$msg = "Your email has been sent, thank you!";
else
// $msg = "Please try again!";
echo $mail->ErrorInfo;
if (isset($_FILES['attachment']['name']) && $_FILES['attachment']['name'] != "") {
unlink($file);
}
}
?>