0
我的頁面上有一個表單,我提交的信息一直保存在我的Hotmail電子郵件中的垃圾文件夾中。我的表單不斷髮送信息給我的垃圾郵件
我不知道該怎麼辦我一直在更改標題,但郵件仍然不斷進入我的垃圾文件夾。
的PHP代碼是:
<?php
$boundary = uniqid('np');
$field_name = $_POST['cf_name'];
$field_email = $_POST['cf_email'];
$field_message = $_POST['cf_message'];
$mail_to = '[email protected]';
$body_message = 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'Message: '.$field_message;
$headers = "MIME-Version: 1.0\r\n";
$headers .= "X-Mailer: PHP's mail() Function\n";
$headers .= "Content-Type: multipart/alternative;boundary=" . $boundary . "\r\n";
$headers .= "Subject: Contact\r\n";
$message = "This is a MIME encoded message.";
$message .= "\r\n\r\n--" . $boundary . "\r\n";
$message .= "Content-type: text/plain;charset=utf-8\r\n\r\n";
$message .= "This is the text/plain version.";
$message .= "\r\n\r\n--" . $boundary . "\r\n";
$message .= "Content-type: text/html;charset=utf-8\r\n\r\n";
$message .= "This is the <b>text/html</b> version.";
$message .= "\r\n\r\n--" . $boundary . "--";
$mail_status = mail($mail_to, $subject, $body_message, $headers);
if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
alert('Thank you for the message. I will contact you shortly.');
window.location = 'http://www.user.com';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Message failed. Please, send an email to [email protected]');
window.location = 'url';
</script>
<?php
}
?>