Rustyhands Posted January 11, 2011 Report Share Posted January 11, 2011 hi everyone..... i have just installed a new contact form to my Wp website and cant seem to get the php to work for the mailer php. hers the code if anyone can help that would be fantastic!!!!!! mailer.php Quote Link to comment Share on other sites More sharing options...
Rustyhands Posted January 11, 2011 Author Report Share Posted January 11, 2011 <?php if(!$_POST) exit; $to = $_POST['emailto']; $subject = 'Contact from '.$_POST['blogname']; $headers = 'From: '.$_POST['contact_email']; $date = date ("l, F jS, Y"); $time = date ("h:i A"); $msg = 'Submitted by '.$_POST['contact_name']." $date at $time.\n\n"; $msg .= $_POST['contact_message']; if (empty($_POST['contact_email']) || !validEmail($_POST['contact_email'])) { $return['invalid_email'] = 1; } if (empty($_POST['contact_name'])) { $return['invalid_name'] = 1; } if (empty($_POST['contact_message'])) { $return['invalid_message'] = 1; } // if no previous errors have been set if (empty($return)) { if (mail($to, $subject, $msg, $headers)) { $return['success'] = 1; } else { $return['success'] = 0; } } echo json_encode($return); function validEmail($email) { $isValid = true; $atIndex = strrpos($email, "@"); if (is_bool($atIndex) && !$atIndex) { $isValid = false; } else { $domain = substr($email, $atIndex+1); $local = substr($email, 0, $atIndex); $localLen = strlen($local); $domainLen = strlen($domain); if ($localLen < 1 || $localLen > 64) { // local part length exceeded $isValid = false; } else if ($domainLen < 1 || $domainLen > 255) { // domain part length exceeded $isValid = false; } else if ($local[0] == '.' || $local[$localLen-1] == '.') { // local part starts or ends with '.' $isValid = false; } else if (preg_match('/\\.\\./', $local)) { // local part has two consecutive dots $isValid = false; } else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain)) { // character not valid in domain part $isValid = false; } else if (preg_match('/\\.\\./', $domain)) { // domain part has two consecutive dots $isValid = false; } else if(!preg_match('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/', str_replace("\\\\","",$local))) { // character not valid in local part unless // local part is quoted if (!preg_match('/^"(\\\\"|[^"])+"$/', str_replace("\\\\","",$local))) { $isValid = false; } } if ($isValid && !(checkdnsrr($domain,"MX") || checkdnsrr($domain,"A"))) { // domain not found in DNS $isValid = false; } } return $isValid; } Quote Link to comment Share on other sites More sharing options...
falkencreative Posted January 11, 2011 Report Share Posted January 11, 2011 Are you using a contact form plugin for this? If not, I'd definitely suggest you look at that - there are a couple good ones that I have used in the past. Quote Link to comment Share on other sites More sharing options...
Rustyhands Posted January 11, 2011 Author Report Share Posted January 11, 2011 na its a built in feature with the theme iam using. not too sure how to rectify Quote Link to comment Share on other sites More sharing options...
falkencreative Posted January 11, 2011 Report Share Posted January 11, 2011 What exactly isn't working about it? The forms don't work? It isn't working like you'd expect it to? (and if so, what do you expect and what does it do?) The forms work but you never receive emails when testing the form? Quote Link to comment Share on other sites More sharing options...
Rustyhands Posted January 12, 2011 Author Report Share Posted January 12, 2011 i ve been informed by the web host that i cant use any php script other than the formail that they use. i have to change the script for the form cause nothing works on it as an error on page comes up at the bottom. im not to sure how to change the script in the new form though. sorry im a novice ...... Quote Link to comment Share on other sites More sharing options...
Rustyhands Posted January 12, 2011 Author Report Share Posted January 12, 2011 does this site have reply emails automation on it????? it would be alot easier Quote Link to comment Share on other sites More sharing options...
falkencreative Posted January 12, 2011 Report Share Posted January 12, 2011 You can "Watch" the topic, which depending on your settings (http://www.killersites.com/community/index.php?app=core&module=usercp&tab=core&area=notifications) will allow you to receive email when people reply. Regarding your form... Assuming you are brand new to PHP (I think you said you are?) you may need to have someone who is familiar with PHP/Wordpress help you out (for a small fee, if necessary.) It sounds like you will need to create a custom PHP based form (probably within a Wordpress custom page template) that integrates with the form processing script your host has provided you. Can you post the PHP script your host expects you to use, plus any links to documentation on it that your host may have provided? I can take a look, but as I said above, it may be a bit difficult to help you with this - short of having someone who is experienced write everything for you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.