quartney Posted January 23, 2010 Share Posted January 23, 2010 I'm super-frustrated because I can't get my contact us email form to work on the freehostia.com servers (and I have a paid plan). I have made three different versions and none of them work. HOWEVER, I've uploaded each of them to a website hosted by a different company and they all work there. Freehostia support put a mail.php file on my account to prove that the mail function works. And the thing is, that mail.php page does send me mail! So, at it's basic, here is the code I'm using to send me email from our contact us page. I am redirected to the contactthanks.html (success) page--I just am not receiving any email at my account afterwards. Does this code look okay? Do you have any suggestions as to what I'm doing wrong? Thanks! <?php $EmailFrom = "[email protected]"; $EmailTo = "[email protected]"; $Subject = "KLEAN E-update signup"; $Name = Trim(stripslashes($_POST['Name'])); $Email = Trim(stripslashes($_POST['Email'])); // validation $validationOK=true; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; exit; } // prepare email body text $Body = ""; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.html\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; } ?> Link to comment https://forums.phpfreaks.com/topic/189529-newbie-question-about-contact-form-on-website/ Share on other sites More sharing options...
quartney Posted January 23, 2010 Author Share Posted January 23, 2010 Looks like the "from" field in the php file has to be from my domain's email (not gmail) for the email to go through! Link to comment https://forums.phpfreaks.com/topic/189529-newbie-question-about-contact-form-on-website/#findComment-1000403 Share on other sites More sharing options...
bl00dshooter Posted January 23, 2010 Share Posted January 23, 2010 Your host needs to have an smtp server to send the email. Link to comment https://forums.phpfreaks.com/topic/189529-newbie-question-about-contact-form-on-website/#findComment-1000419 Share on other sites More sharing options...
quartney Posted January 23, 2010 Author Share Posted January 23, 2010 Your host needs to have an smtp server to send the email. my host does have an smtp server. Link to comment https://forums.phpfreaks.com/topic/189529-newbie-question-about-contact-form-on-website/#findComment-1000421 Share on other sites More sharing options...
bl00dshooter Posted January 23, 2010 Share Posted January 23, 2010 Create a new php file and put this in it: <?php mail('[email protected]','KLEAN E-update signup','test'); ?> wait about 10 minutes, and see if the email arrives. If it doesn't, contact your host. Link to comment https://forums.phpfreaks.com/topic/189529-newbie-question-about-contact-form-on-website/#findComment-1000422 Share on other sites More sharing options...
quartney Posted January 23, 2010 Author Share Posted January 23, 2010 Thanks. I posted the solution in my second post, which was that the "from" field had to be from my domain name, not from gmail. Link to comment https://forums.phpfreaks.com/topic/189529-newbie-question-about-contact-form-on-website/#findComment-1000423 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.