因此,我正在使用电子邮件作为联系表格。 当有人给我发送电子邮件时,它显示“警告-可疑”,而gmail则认为这是垃圾邮件。 代码如下: 如果有人能帮助我,我将不胜感激。
<?php
if($_POST && isset($_FILES))
{
$from_email = $_POST['bazsolino@gmail.com']; // sender email
$to_email = 'bazsolino@gmail.com'; //recipient email
//Capture POST data from HTML form and Sanitize them,
$sender_name = filter_var($_POST["sender_name"], FILTER_SANITIZE_STRING); //sender name
$phone = filter_var($_POST["phone"], FILTER_SANITIZE_STRING); //phone
$reply_to_email = filter_var($_POST["sender_email"], FILTER_SANITIZE_STRING); //sender email used in "reply-to" header
$subject = filter_var($_POST["subject"], FILTER_SANITIZE_STRING); //get subject from HTML form
$message = filter_var($_POST["message"], FILTER_SANITIZE_STRING); //message
$formcontent=" Feladó neve: $sender_name \n Telefonszám: $phone \n Üzenet: $message";
$boundary = md5("regga");
//header
$headers = "MIME-Version: 1.0\r\n";
$headers .= "From:".$from_email."\r\n";
$headers .= "Reply-To: ".$reply_to_email."" . "\r\n";
$headers .= "Content-Type: multipart/mixed; boundary = $boundary\r\n\r\n";
//plain text
$body = "--$boundary\r\n";
$body .= "Content-Type: text/plain; charset=UTF-8\r\n";
$body .= "Content-Transfer-Encoding: base64\r\n\r\n";
$body .= chunk_split(base64_encode($formcontent));
$sentMail = @mail($to_email, $subject, $body, $headers);
if($sentMail)
{
echo "Köszönjük, hogy felvetted velünk a kapcsolatot, hamarosan visszajelzünk!" . " -" . "<a href='index' style='text-decoration:none;color:#000;'> Vissza a főoldalra</a>";
}else{
die('Could not send mail! Please check your PHP mail configuration.');
}
}
?>