私のサーバーでは正常に動作する電子メール スクリプトがありますが、それを別のサーバーに置くと、サーバー名を localhost からその名前に変更する必要があります。私が持っている電子メール スクリプトにはサーバー名がありません。以下はスクリプトです...
<?PHP
$email = $_POST["emailaddress"];
$firstname = $_POST["firstname"];
$lastname = $_POST["lastname"];
$zipcode = $_POST["zipcode"];
$feedback = $_POST["feedback"];
$date=date("d-m-Y");
$to = "";
$subject = "New Feedback Received";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: $email\n";
$message = "
<html>
<head></head>
<body>
A visitor to your website has left the following feedback; <br /><br />
Date: $date <br />
First Name: $firstname <br />
Last Name: $lastname <br />
Zip Code: $zipcode <br />
Email Address: $email <br />
Feedback: $feedback <br />
<img src=\"" />
</body>
</html>
";
$user = "$email";
$usersubject = "Thank You";
$userheaders = 'MIME-Version: 1.0' . "\r\n";
$userheaders .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$userheaders .= "From: info@westmorelandberryfarm.com\n";
$usermessage =
"
<html>
<head></head>
<body>
Thank you for your feedback, your comments are important to us.
<br /><br />
We hope to see you at the Farm very soon!
<br /><br />
<br />
Tel: <br />
<a href=\""</a><br />
<img src=\"" />
</body>
</html>
";
mail($to,$subject,$message,$headers);
mail($user,$usersubject,$usermessage,$userheaders);
$fh = fopen("feedback.txt", "a");
fwrite($fh, "Date:$date\r\nFirst Name:$firstname\r\nLast Name:$lastname\r\nEmail:$email\r\nZip Code:$zipcode\r\nFeedback:$feedback\r\n \r\n");
fclose($fh);
?>