I have a PHP script that uses the mail() function and now is getting the following error:
500 Error
An internal server error has occurred. Please try your request again momentarily.
•File or directory permissions are set too high: Files should be 0644, directories 0755.
•Problem with your .htaccess file.
•A syntax error in a CGI script.
The code below I have been using for about a year and has been working fine until lately. I've also noticed many people are having the same problem throughout yet have not found any posting of a solution or if x10 has figure out what the issue is.
I have also tried an x10Hosting PHP email() function sample code at the very bottom. Even this code is not working and is supposedly what x10 recommend for proper coding and configurations. I am using the php mail() function in my feedback form for customers to get ahold of me and now it's not working. Any admins know what the problem may be? Would appreciate a resolution to this. Thanks in advance for any help.
<?php
// VIA EMAIL ACCOUNT ON x10hosting.com SERVER: boru
$mailto = 'email@ejweb.pcriot.com' ;
$subject = "Feedback Form" ;
$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
$name = $_POST['name'] ;
$email = $_POST['email'] ;
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );
if (get_magic_quotes_gpc()) {
$comments = stripslashes( $comments );
}
$messageproper =
"This message was sent from:\n" .
"$http_referrer\n" .
"------------------------------------------------------------\n" .
"Name of sender: $name\n" .
"Email of sender: $email\n" .
$comments .
"\n\n------------------------------------------------------------\n" ;
$mailfrom = "$name <$email>";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/plain; charset=iso-8859-1' . "\r\n";
$headers .= "From: " . $mailfrom . "\r\n";
$message = $comments . "\n\n";
// Send the email - strlen($HTTP_SERVER_VARS['QUERY_STRING']) > 2
if (mail($mailto, $subject, $message, $headers) AND strlen($mailto) > 2)
{
echo "<p><font color='#ff0000'>Your E-Mail was successfully sent. Please click your back-button on your browser ...</font><p><a href='/'>HOME</a>";
//print "<p>Your E-mail has been sent...";
} else {
echo "<p>Error; the email may not have been sent due to system error. Please try the other form on the contact/feedback page.";
}
exit ;
?>
SAMPLE 2:
<?php
// ~~~~~~~~~~ x10Hosting Users EXAMPLE: ~~~~~~~~~~
$fromemail = stripslashes($_POST['fromemail']);
$toemail = stripslashes($_POST['toemail']);
$headers = 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";
$headers .= "Content-Transfer-Encoding: 7bit\n";
$headers .= 'From: Fromname <'.$fromemail.'>' . "\n";
$headers .= 'Reply-To: '.$fromemail."\n";
$headers .= 'X-Mailers: PHP /'.phpversion() . "\n";
$subject = $_POST['subject'];
$message = $_POST['msg'];
if (@mail($toemail,stripslashes($subject),stripslashes($message),stripslashes($headers)))
{
echo ('<p>Your message has been sent.</p>');
}
else
{
echo ('<p>Your message has failed to send.</p>');
}
?>
500 Error
An internal server error has occurred. Please try your request again momentarily.
•File or directory permissions are set too high: Files should be 0644, directories 0755.
•Problem with your .htaccess file.
•A syntax error in a CGI script.
The code below I have been using for about a year and has been working fine until lately. I've also noticed many people are having the same problem throughout yet have not found any posting of a solution or if x10 has figure out what the issue is.
I have also tried an x10Hosting PHP email() function sample code at the very bottom. Even this code is not working and is supposedly what x10 recommend for proper coding and configurations. I am using the php mail() function in my feedback form for customers to get ahold of me and now it's not working. Any admins know what the problem may be? Would appreciate a resolution to this. Thanks in advance for any help.
<?php
// VIA EMAIL ACCOUNT ON x10hosting.com SERVER: boru
$mailto = 'email@ejweb.pcriot.com' ;
$subject = "Feedback Form" ;
$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
$name = $_POST['name'] ;
$email = $_POST['email'] ;
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );
if (get_magic_quotes_gpc()) {
$comments = stripslashes( $comments );
}
$messageproper =
"This message was sent from:\n" .
"$http_referrer\n" .
"------------------------------------------------------------\n" .
"Name of sender: $name\n" .
"Email of sender: $email\n" .
$comments .
"\n\n------------------------------------------------------------\n" ;
$mailfrom = "$name <$email>";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/plain; charset=iso-8859-1' . "\r\n";
$headers .= "From: " . $mailfrom . "\r\n";
$message = $comments . "\n\n";
// Send the email - strlen($HTTP_SERVER_VARS['QUERY_STRING']) > 2
if (mail($mailto, $subject, $message, $headers) AND strlen($mailto) > 2)
{
echo "<p><font color='#ff0000'>Your E-Mail was successfully sent. Please click your back-button on your browser ...</font><p><a href='/'>HOME</a>";
//print "<p>Your E-mail has been sent...";
} else {
echo "<p>Error; the email may not have been sent due to system error. Please try the other form on the contact/feedback page.";
}
exit ;
?>
SAMPLE 2:
<?php
// ~~~~~~~~~~ x10Hosting Users EXAMPLE: ~~~~~~~~~~
$fromemail = stripslashes($_POST['fromemail']);
$toemail = stripslashes($_POST['toemail']);
$headers = 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";
$headers .= "Content-Transfer-Encoding: 7bit\n";
$headers .= 'From: Fromname <'.$fromemail.'>' . "\n";
$headers .= 'Reply-To: '.$fromemail."\n";
$headers .= 'X-Mailers: PHP /'.phpversion() . "\n";
$subject = $_POST['subject'];
$message = $_POST['msg'];
if (@mail($toemail,stripslashes($subject),stripslashes($message),stripslashes($headers)))
{
echo ('<p>Your message has been sent.</p>');
}
else
{
echo ('<p>Your message has failed to send.</p>');
}
?>