I'm getting the 500 Internal Server Error. I called goDaddy and they told me it's not something on their end. I also don't have a .htaccess file. I checked the contact page and checked spelling it is calling the right .php file.
This code was working perfectly. I tried to change something it didn't work. I tried going back to the original code and now that doesn't work either. I don't have a backup. I commented out line by line to pin-point the problem if I erase the mail($to, $subject, $message, $headers);
part I don't get an error but obviously don't receive anything. Here is the website if that helps to inspect.
http://www.crownjewelre.com/contacts.html
<?php
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$email = $_POST['email'];
$telephone = $_POST['telephone'];
$comments = $_POST['comments'];
// multiple recipients
$to = 'michaelgaraysi@yahoo.com' . ', '; // note the comma
// subject
$subject.= "CrownJewelRe question From: ".$first_name." ".$last_name. "\n";
// message
$message = "
<html>
<head>
<title>Contact Information</title>
</head>
<body>
<table>
<tr>
<td>Name: </td><th>".$first_name."</th><th>".$last_name."</th>
</tr>
<tr>
<td>Email: </td><th>".$email."</th>
</tr>
<tr>
<td>Telephone: </td><th>".$telephone."</th>
</tr>
</table>
<br><br>
<p>Comments: <strong>".$comments."</strong></th>
</body>
</html>
";
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
// Mail it
mail($to, $subject, $message, $headers);
?>
try to change,
$to = 'michaelgaraysi@yahoo.com' . ', ';
to
$to = 'michaelgaraysi@yahoo.com';
and
$subject.= "CrownJewelRe question From: ".$first_name." ".$last_name. "\n";
to
$subject= "CrownJewelRe question From: ".$first_name." ".$last_name. "\n";
and finally, try to run this simple php mailer script, and then apply your changes,
<?php
$to = 'michaelgaraysi@yahoo.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: birthday@example.com' . "\r\n" .
'Reply-To: birthday@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
like the others $subject.= is auto-expand of a non existing var but that not the problem here :)
1st : have you tested a blank page with only the function mail :
mail ('michaelgaraysi@yahoo.com','test','message corpus');
if its working its not a missconfig of youre PHP.
2nd : How can you use in 2015 the mail function, its have a high spam rate, instead use https://github.com/PHPMailer/PHPMailer or other.
I think it will solve your problem or maybe you just need to remove the "\\n"; on $subject :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.