eaglerod
asked on
PHP Email Problem
So we moved our website over and I have a PHP page that is setup to email the form to us. Its not happening. I know NOTHING about PHP and can't figure out how it was working on the old server. We had to have outlook express open on the old server for his website he was hosting on it to work. Now its on the new server and the website works but no data is being transmitted. Here is the PHP form for the feedback page.
<?
$recipient = "test@test.com";
$subject = "Feedback Inquiry";
$message ="From: ".$salutation." ".$first_name." ".$last_name."\n";
$message =$message."Company: ".$company."\n";
$message =$message."email: ".$email."\n";
$message =$message."phone: ".$phone."\n";
$message =$message." ".$city.",".$state." ".$zip." ".$country."\n";
$message =$message."Preferred mode of contact is: ".$prefcontact."\n";
$message =$message."Add to marketing updates contact list: ".$updateslist."\n";
$message =$message."Additional Comments: ".$additionalcomments."\n" ;
$extra = "From:".$email;
mail ($recipient, $subject, $message, $extra);
?>
<html>
<head><title>Thank you</title></head>
<table width=100% >
<tr>
<td colspan=2 ALIGN="center" VALIGN="middle">
<img src="images/thankyou.gif">
</td>
</tr>
<tr>
<td colspan=2 ALIGN="center" VALIGN="middle">
Your inquiry has been submitted, thank you.
<td>
</tr>
<tr>
<td colspan=2 ALIGN="center" VALIGN="middle">
 <td>
</tr>
<tr>
<td colspan=2 ALIGN="center" VALIGN="middle">
To return to the previous page, click here <a href="http://www.bbbbb.com/feedback.htm"<strong>Return to Contact Us</strong>
</a>
<td>
</tr>
</table>
</html>
<?
$recipient = "test@test.com";
$subject = "Feedback Inquiry";
$message ="From: ".$salutation." ".$first_name." ".$last_name."\n";
$message =$message."Company: ".$company."\n";
$message =$message."email: ".$email."\n";
$message =$message."phone: ".$phone."\n";
$message =$message." ".$city.",".$state." ".$zip." ".$country."\n";
$message =$message."Preferred mode of contact is: ".$prefcontact."\n";
$message =$message."Add to marketing updates contact list: ".$updateslist."\n";
$message =$message."Additional Comments: ".$additionalcomments."\n"
$extra = "From:".$email;
mail ($recipient, $subject, $message, $extra);
?>
<html>
<head><title>Thank you</title></head>
<table width=100% >
<tr>
<td colspan=2 ALIGN="center" VALIGN="middle">
<img src="images/thankyou.gif">
</td>
</tr>
<tr>
<td colspan=2 ALIGN="center" VALIGN="middle">
Your inquiry has been submitted, thank you.
<td>
</tr>
<tr>
<td colspan=2 ALIGN="center" VALIGN="middle">
 <td>
</tr>
<tr>
<td colspan=2 ALIGN="center" VALIGN="middle">
To return to the previous page, click here <a href="http://www.bbbbb.com/feedback.htm"<strong>Return to Contact Us</strong>
</a>
<td>
</tr>
</table>
</html>
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Don't know if this is applicable to your situation, but in most Linux that run SELinux, the webserver is not allowedto send email by default, to check it you can run:
# getsebool httpd_can_sendmail
If the output shows that the boolean is set to 'off', to enable it run:
# setsebool -P httpd_can_sendmail 1
Other than that, again if you're on a Linux system, try sending an email manually from the command-line, you may not have postfix or sendmail setup properly.
# getsebool httpd_can_sendmail
If the output shows that the boolean is set to 'off', to enable it run:
# setsebool -P httpd_can_sendmail 1
Other than that, again if you're on a Linux system, try sending an email manually from the command-line, you may not have postfix or sendmail setup properly.
You may find that the PHPMailer class can help with this (Google it) but if you don't know PHP you would expect to hire a professional programmer to help you get it installed and running.
I believe that the would be in the $extra variable.
mail uses whatever the local smtp server is for the server that is running it so if it isn't set up then it shouldn't send.
Here is the manual page on mail http://php.net/manual/en/f
You should check either the error log for php or set ini_set('display_errors','