Jump to content

PHP email not working with Chrome


confused and dazed

Recommended Posts

Hello internet,

 

I tried asking this question once already but there were no responses. Does this mean my question is not written well - or there are no suggestions...

 

Here is my question...

The issue of the day is this… I have a successful form that submits user information to my database through a php file. Using chrome it will send the user information to the database but will not kick out an email. This is strange. IE/Safari work just fine – but Chrome will not work. What small nuance am I missing?

 

Link to comment
Share on other sites

You didn't provide any code. There's no reason I can think of that a browser difference would change how PHP runs unless you're specifically checking for browsers. If you're using Javascript code and ajax requests or something like that, maybe there's a difference in the request. If that's the case then use your developer tools to look at the requests in both browsers.

Link to comment
Share on other sites

Here is the body of the PHP file. It works everytime in IE but not in Chrome or Safari(now its not working in Safari)

 

<body> Your contact form has been recorded<br> Thank you.<br> <?php $con = mysql_connect("xx","xx","xx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("xx", $con);

$Cname = $_POST['m_contact_name']; $Cemail = $_POST['m_contact_email']; $Cphone = $_POST['m_contact_phone']; $Ccomment = $_POST['m_contact_feedback'];

$to1 = "emailaddress1"; $to2 = "emailaddress2"; $subject = "Contact Form Submitted"; $message = "<html><body>

Contact Form Name:<br> $Cname<br><br> Contact Form Email:<br> $Cemail<br><br> Contact Form Phone:<br> $Cphone<br><br> Contact Form Comment:<br> $Ccomment<br><br>

</body></html>"; $from = "$to1"; $headers = "From: $to1rn"; $headers .= "Content-type: text/htmlrn"; mail($to1,$subject,$message,$headers); mail($to2,$subject,$message,$headers); mysql_close($con) ?></body>

Link to comment
Share on other sites

If the problem is sending out the email, what have you done to check that part of the code is working as expected? You just seem to be assuming things without digging down anywhere.

 

I don't see you checking the return of mail(). Are you confident a mail system is setup on your machine / host (sendmail , postifx, etc)? Did you check the spam filter of the email address in question?

Link to comment
Share on other sites

  • 2 weeks later...

For whatever reason its now working on FF/IE/Chrome... So strange

 

justsomeguy - Seems strange that now it works...

 

thescientist - not assuming anything - I was testing with my own email accounts and was checking the spam folders along the way. I was confident it was sending out because it was working when I was testing an IE browser - I did mention that. Usually you give good feedback - seems your latest comments were a little pointed.

 

Can you guys think of why it could be working now and not when I first wrote the post? Something maybe with the ini version I'm using or my hosting account particulars.... anything you can think of?

Link to comment
Share on other sites

PHP doesn't behave differently for different browsers. You would need to check the $_SERVER array yourself and check for the user agent string to have it respond to different clients in different ways.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...