October 16, 200917 yr I have installed a basic email contact form on the bottom of MY SITE , It is isn't styled yet but it is installed. It is supposed to send the contents to my email address but it doesn't. I have been through loads of different tutorials and never get it to work! The sent page comes up saying it's been sent to my email but i check my email to no fruition. It is a PHP form and the path to the php file is www.motif.tv/mailer.php Will someone once and for all be able to take up the challenge and tell me how to make this work? Thanks guys Luke
October 16, 200917 yr It's quite sad but I think I recognise the script you're using from the error message it produced: blarg! It's some PHP/AJAX enabled contact form right? I tried to use this earlier in the week, but found it waaaaay too complicated for a simple form. The PHP contact forms I use on my website use this simple PHP script: <?PHP # This contact form is used to collect data from a PHP form and email to a specified address below. error_reporting(7); #---------- # Validate: Email function check_email($email, $optional) { if ( (strlen($email) == 0) && ($optional === true) ) { return true; } elseif ( eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email) ) { return true; } else { return false; } } function check_telephone($telephone, $optional) { if ( (strlen($telephone) == 0) && ($optional === true) ) { return true; } elseif ( eregi("^.{9,20}$", $telephone) ) { return true; } else { return false; } } if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ClientIP = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ClientIP = $_SERVER['REMOTE_ADDR']; } # RegisterGlobals OFF $name = $_POST['name']; $telephone = $_POST['telephone']; $email = $_POST['email']; $enquiry = $_POST['enquiry']; $submitbutton = $_POST['submitbutton']; if (get_magic_quotes_gpc) { $name = stripslashes($name); $email = stripslashes($email); $telephone = stripslashes($telephone); $enquiry = stripslashes($enquiry); $submitbutton = stripslashes($submitbutton); } # Fields Validations $validationFailed = false; if ( (! check_email($email, false))) { $validationFailed = true; } if ( (! check_telephone($telephone, false))) { $validationFailed = true; } # Redirect user to the error page if ($validationFailed == true) { header("Location: http://www.website.co.uk/error.html"); exit; } # Email to Form Owner $emailTo = '"Your Company" <email@website.co.uk>'; $emailSubject = "You have received an enquiry from the website"; $emailSubject = preg_replace('/[\x00-\x1F]/', '', $emailSubject); $emailFrom = "$email"; $emailFrom = preg_replace('/[\x00-\x1F]/', '', $emailFrom); $emailBody = "<style type=\"text/css\"> <!--div#content {font-family:Arial, sans-serif;font-size:13px;}--></style> <div id=\"content\"><img src=\"http://www.website.co.uk/img/logo.png\" height=\"116\" width=\"200\"><br><br> This user has enquired about the products and wants more information. <br><br>Name: $name <br><br>Email: $email <br><br>Telephone: $telephone <br><br>Enquiry: $enquiry </div>"; $emailHeader = "From: $emailFrom\n" . "Reply-To: $emailFrom\n" . "MIME-Version: 1.0\n" . "Content-type: text/html; charset=\"ISO-8859-1\"\n" . "Content-transfer-encoding: 8bit\n"; mail($emailTo, $emailSubject, $emailBody, $emailHeader); # Redirect user to success page header("Location: http://www.website.co.uk/thanks.html"); exit; # End of PHP script ?> If you have any PHP knowledge you should be able to pick apart the code and work out what each part is. The HTML form is dead simple, just some input fields, a POST form with the action link to the PHP containing this code. Hopefully this'll work for you. Darren
October 19, 200917 yr Hi, Be careful not to use the same email address in the contact form that you use to send the email to. I find that some mail servers refuse to send emails to themself.
October 19, 200917 yr Hi, Be careful not to use the same email address in the contact form that you use to send the email to. I find that some mail servers refuse to send emails to themself. What do you mean? The script sends an email to my/your email address, and the listed From address is the email address the user enters, so it's as if they have sent the email directly.
October 19, 200917 yr I think I know what TopShopper means. The email that the form sends to you might be to you@dmpinder.com but that is sent from the same domain dmpinder.com which is processing the form, so the hosting service thinks that it's sending to itself, so if the hosting service objects, you will have to use an email address that isn't from the same domain, like you@hotmail.com
October 19, 200917 yr Ahh right I understand, so if the form was hosted on Website A, it needs to be sent to an email address hosted on Website B. Does it matter that they're on the same server, or is it just web address that needs to be different? I must admit I've never come across this problem before, perhaps my hosts are cool with it, but I'll definitely keep that in mind in future. Cheers, Darren
October 19, 200917 yr Just to clarify what I meant. I have mailing scripts which send out emails when a customer buys somthing from the shop. If the shop is on the topdown.co.uk domain and I have set the administration address as xxx@topdown.co.uk for instance and then whilst testing I inadvertantly use the same email address when pretending to be the shopper, sometimes I find that the email isn't sent. It is something I have to warn my clients about but have never got to the bottom of when and why this happens.
Create an account or sign in to comment