2vmonster Posted July 8, 2008 Share Posted July 8, 2008 Hello all! My first post here and was needing a little help. I have a contact form on a site for contacting the owner and cannot get it to send... the functions seem to work and it says email has been sent but I never receive it. This maybe a dumb question but i figured i would ask. -I am running Mamp locally to test.. will this be the issue? code: <?php $dontsendemail = 0; $possiblespam = FALSE; $strlenmessage = ""; $email = $_REQUEST['email']; $message = $_REQUEST['message']; $subject = "!!!Website Contact Form!!!";$emailaddress = "[email protected]"; function checkemail($field) { // checks proper syntax if( !preg_match( "/^([a-zA-Z0-9])+([a-zA-Z0-9._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9._-]+)+$/", $field)) { die("Improper email address detected. Please hit your browser back button and try again."); return 1; } } function spamcheck($field) { if(eregi("to:",$field) || eregi("cc:",$field) || eregi("\r",$field) || eregi("\n",$field) || eregi("%0A",$field)){ $possiblespam = TRUE; }else $possiblespam = FALSE; if ($possiblespam) { die("Possible spam attempt detected. If this is not the case, please edit the content of the contact form and try again."); return 1; } } function strlencheck($field,$minlength,$whichfieldresponse) { if (strlen($field) < $minlength){ die($whichfieldresponse); return 1; } } if ($dontsendemail == 0) $dontsendemail = checkemail($email); if ($dontsendemail == 0) $dontsendemail = spamcheck($email); if ($dontsendemail == 0) $dontsendemail = spamcheck($subject); if ($dontsendemail == 0) $dontsendemail = strlencheck($email,10,"The email address field is too short. Please hit your browser back button and check your entry.<br />"); if ($dontsendemail == 0) $dontsendemail = strlencheck($message,5,"The message field is too short. Please hit your browser back button and check your entry.<br />"); if ($dontsendemail == 0) $dontsendemail = strlencheck($emailaddress,8,"You have not selected a recipient of your message. Please hit your browser back button and check your entry.<br />"); if ($dontsendemail == 0) {mail($emailaddress,"Subject: $subject",$message,"From: $email" ); echo "Thank You.. Slim has received your message!! Use back in your browser window to return to the previous page!";} ?> Link to comment https://forums.phpfreaks.com/topic/113672-contact-form-on-site-using-php/ Share on other sites More sharing options...
ratcateme Posted July 8, 2008 Share Posted July 8, 2008 have you setup the mail function you properly want it to forward mail to your ISP's mail servers Scott. Link to comment https://forums.phpfreaks.com/topic/113672-contact-form-on-site-using-php/#findComment-584157 Share on other sites More sharing options...
2vmonster Posted July 8, 2008 Author Share Posted July 8, 2008 good question!! may sound very newbie.. how would i go about doing this. (my first time at php and server side coding) Link to comment https://forums.phpfreaks.com/topic/113672-contact-form-on-site-using-php/#findComment-584662 Share on other sites More sharing options...
ratcateme Posted July 9, 2008 Share Posted July 9, 2008 create a page like this <?php phpinfo(); ?> that will print out most if the settings from your php.ini file if your on linux you want a line like sendmail_path = /usr/sbin/sendmail -t -i or something similar on windows i think you want SMTP = smtp.your.isp.com smtp_port = 25 Scott. Link to comment https://forums.phpfreaks.com/topic/113672-contact-form-on-site-using-php/#findComment-585770 Share on other sites More sharing options...
revraz Posted July 9, 2008 Share Posted July 9, 2008 Is this a shared host or your own server? Link to comment https://forums.phpfreaks.com/topic/113672-contact-form-on-site-using-php/#findComment-585771 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.