Jump to content
confused and dazed

PHP email not working with Chrome

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?

 

Share this post


Link to post
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.

Share this post


Link to post
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>

Share this post


Link to post
Share on other sites

There isn't any browser-specific code there. It probably has something to do with the form.

Share this post


Link to post
Share on other sites

OK. Again, there is nothing in any of that code that has anything to do with the browser vendor or version.

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...