Jump to content

monty 187

Members
  • Posts

    46
  • Joined

  • Last visited

Everything posted by monty 187

  1. The problem is that the code does not seem to be validating the email. It allows me to enter just a row of characters without an @. Im thinking it is a dodgy call to the validate function call but i cant see it!!ThanksGuys!!
  2. Hi guys,did anyone spot the error here in why the email check is not working??Thanks
  3. excellent. i have now inserted that and it appears to be processing the code but it is not picking up any Bad email addressesheres the code---><html><?php//has anything been submitted?if (isset($_REQUEST['email'])) { //if yes validate the mail address if(checkEmail($_REQUEST['email'])) { $email = $_REQUEST['email'] ; $subject = $_REQUEST['subject'] ; $message = $_REQUEST['message'] ; mail( "mmontgomery@xxx.com", "Subject: $subject", $message, "From: $email" ); echo "Thank you for using our mail form"; } else { echo "this is not a valid email!!"; } }else { echo "<form method='post' action='mailform.php'> Email: <input name='email' type='text' /><br /> Subject: <input name='subject' type='text' /><br /> Message:<br /> <textarea name='message' rows='15' cols='40'> </textarea><br /> <input type='submit' /> </form>"; }function checkEmail($email) { if(eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]", $email)) { return FALSE; } list($Username, $Domain) = split("@",$email); if(getmxrr($Domain, $MXHost)) { return TRUE; } else { if(fsockopen($Domain, 25, $errno, $errstr, 30)) { return TRUE; } else { return FALSE; } }}?></body></html>
  4. Thanks A million guys, i had rooted around and found the validation function, the problem is i am unsure where to call it from in the script! Is it when the submit button is pressed? if so could you explain how i go about this.<html><?phpif (isset($_REQUEST['email'])) { $email = $_REQUEST['email'] ; $subject = $_REQUEST['subject'] ; $message = $_REQUEST['message'] ; mail( "mmontgomery@mmm.com", "Subject: $subject", $message, "From: $email" ); echo "Thank you for using our mail form"; }else { echo "<form method='post' action='mailform.php'> Email: <input name='email' type='text' /><br /> Subject: <input name='subject' type='text' /><br /> Message:<br /> <textarea name='message' rows='15' cols='40'> </textarea><br /> <input type='submit' /> </form>"; }?></body></html>
  5. Hi, i was wondering if you knew the best way to validate a form by mail set up with php. I have got the mail working but want to ensure all fields have been filled and that the email address is a valid one.
×
×
  • Create New...