我有一个网站的“预订”部分,要求在发送电子邮件之前完成所有字段。由于该网站相对受欢迎,因此我们白天会收到很多请求。我正在使用PHPMailer接收电子邮件。
很遗憾,我收到的某些电子邮件采用以下格式:
A client has made a request to book an appointment.
Client Name: 5c3a5beb89e89
Client Email: sbethdddany5996@gmail.com
Client Number:
Message:
该电子邮件是垃圾邮件。如何避免这种情况?以下是我的PHP脚本。
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$msg = $_POST['msg'];
require 'phpmailer/PHPMailerAutoload.php';
$mail = new PHPMailer();
$mail->isSMTP();
$mail->Host = "***";
$mail->SMTPSecure = "tsl";
$mail->Port = ***;
$mail->SMTPAuth = true;
$mail->Username = '***';
$mail->Password = '***!';
$mail->setFrom($email, $totalName);
$mail->addAddress('***');
$mail->Subject = "Appointment Request";
$mail->Body = "A client has made a request to book an apointment.
\n\nClient Name: $name \n\nClient Email: $email \n\nClient Number: $phone \n\nMessage: $msg";
if ($mail->send()){
header('Location: index.html');
}
else{
echo "Something went wrong, please try again.";
}
?>