【发布时间】:2015-11-06 21:41:13
【问题描述】:
用户在我的域中发布的邮件可以发送到我的网络邮箱,但随后用户无法收到我发送到他们电子邮件地址的邮件副本。除此之外,我的webmail可以回复邮件到用户的电子邮件地址,但只有gmail帐户可以在垃圾邮件文件夹中收到我的回复,但是yahoo和hotmail帐户没有收到我的webmail的任何回复消息。起初 yahoo 帐户仍然可以从 webmail 接收消息副本和回复消息。但是现在完全不行了。我能知道是什么问题吗?谢谢你的好意帮助!
<?php
session_start();
include("functions/functions.php");
?>
<?php
if(isset($_POST['submit'])){
$ip = getIP();
$userName= $_POST['userName'];
$phoneNumber= $_POST['phoneNumber'];
$email= $_POST['email'];
$message= $_POST['message'];
$currentdatetime=date('Y-m-d');
if(empty($userName)||empty($phoneNumber)||empty($email)||empty($message))
{
echo "<script type='text/javascript'>alert('All the fields must be filled in. Please try again.');";
echo "window.location.href='contact.php';";
echo"</script>";
exit();
}
else if (ctype_alpha(str_replace(' ', '', $userName)) === false) {
echo "<script type='text/javascript'>alert('Name must only contain letters!');";
echo "window.location.href='contact.php';";
echo"</script>";
exit();
}
else if(strlen($phoneNumber)<11 || strlen($phoneNumber)>12|| substr($phoneNumber, 3, 1)!='-')
{
echo "<script type='text/javascript'>alert('Phone Format is incorrect. Please use the following format: 01x-1234567');";
echo "window.location.href='contact.php';";
echo"</script>";
exit();
}
else if((strpos("$email","@")== 0)|| (strpos("$email",".com")== 0) )
{
echo "<script type='text/javascript'>alert('Email Format is incorrect.');";
echo "window.location.href='contact.php';";
echo"</script>";
exit();
}
else if($_POST['userName']!=''&& $_POST['phoneNumber']!='' && $_POST['email']!='' && $_POST['message']!='' ){
$to = "email@site.com"; // this is my Email address
$from = $_POST['email']; // this is the sender's Email address
$name = $_POST['userName'];
$contact = $_POST['phoneNumber'];
$subject = "Form submission";
$subject2 = "Copy of your form submission";
$message ="Dear Sir/Madam,". "\n\n" ."New enquiry as below:" . "\n\n" ."Name:" .$name . "\n\n" . "Contact No: " . $contact. "\n\n" ."Email Address:". $from. "\n\n" ."Message/Enquiry:". $_POST['message'];
$message2 = "Here is a copy of your message " . $name . "\n\n" . $_POST['message'];
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers2 = "MIME-Version: 1.0" . "\r\n";
$headers2 .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers = "From:" . $from;
$headers2 = "From:" . $to;
mail($to,$subject,$message,$headers);
mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
echo "<script>alert('Mail Sent. Thank you " . $name . ", we will contact you shortly.')</script>";
}
//insert into databse
$insert_msg = "insert into msg(userName, phoneNumber, email, message, status, msg_date) values ('$userName', '$phoneNumber', '$email', '$message', 'Pending', '$currentdatetime')";
$run_msg = mysqli_query($con, $insert_msg);
}
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<!--start-contact-->
<div class="contact">
<div class="container">
<h3>CONTACT US</h3>
<p>Please contact us for all inquiries and purchase options.</p>
<form action='' method='POST'>
<input type="text" name='userName' placeholder="NAME" required>
<input type="text" name='phoneNumber' placeholder="PHONE NUMBER" required>
<input class='user' name='email' type="text" placeholder="EMAIL" required><br>
<textarea name='message' placeholder="MESSAGE"></textarea>
<input type="submit" name="submit" value="SEND">
</form>
</div>
</div>
<!--end-contact-->
</body>
</html>
【问题讨论】: