Menu

Visitor's mailadress

Help
ladybirdie
2006-02-19
2013-06-03
  • ladybirdie

    ladybirdie - 2006-02-19

    Hi, I thought everything was finally working! Up until now visitors could send me mail ans I received them. But I asked my friends to test the form for me, and one of them sees the following while entering her mailadress :

    The following errors occured while processing your form input. Invalid email address entered

    It's a hotmail-adress and I think it must be the _ sign within her adress? All the other hotmailadresses work correctly.

    What can I do to make the form work with this '_' in the mailadresses??

    Hope you can help, I made the site for a pub, so it needs to work!

    (p.s. hope my English is ok, I'm Dutch)

     
    • TNTEverett

      TNTEverett - 2006-02-19

      The email address check is pretty standard.  It does allow the "_" character.  In most cases an error occurs due to a leading or trailing space.  Try adding this to your process.php file just before the address check:
      $email = trim($email);
      This assumes your variable name for the email adderss is "$email".

       
    • ladybirdie

      ladybirdie - 2006-02-20

      Hi, sorry for another question, but just to be sure I don't mess it up, below is my process.php. Where exactly do you mean?

      <?php
      include("global.inc.php");
      $errors=0;
      $error="The following errors occured while processing your form input.<ul>";
      pt_register('POST','Naam');
      pt_register('POST','Email');
      pt_register('POST','Telefoonnummer');
      pt_register('POST','Website');
      pt_register('POST','Vragenofopmerkingen');
      $Vragenofopmerkingen=preg_replace("/(\015\012)|(\015)|(\012)/","&nbsp;<br />", $Vragenofopmerkingen);if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){
      $error.="<li>Invalid email address entered";
      $errors=1;
      }
      if($errors==1) echo $error;
      else{
      $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
      $message="Naam: ".$Naam."
      Email: ".$Email."
      Telefoonnummer: ".$Telefoonnummer."
      Website: ".$Website."
      Vragen of opmerkingen: ".$Vragenofopmerkingen."
      ";
      $message = stripslashes($message);
      mail("mymail@lycos.nl","Form Submitted at your website",$message,"From: phpFormGenerator");

      header("Refresh: 0;url=http://www.vincents.nl/bedankt.htm");
      ?><?php
      }
      ?>

       
      • TNTEverett

        TNTEverett - 2006-02-20

        Right after the post will do.

        pt_register('POST','Email');
        $Email=trim($Email);

         
    • ladybirdie

      ladybirdie - 2006-02-20

      Hi, just made the changes an uploaded it all, but the mailadress with _@hotmail.com still doesn't work, the same message appears that it's an invalid email adress.

      Do you have any other ideas?

      I thought about making a new form, and make the Email a text box instead of an 'E-mail'. Or is that not a good idea? Or if it is an good idea, can I also change this in the existing form so that I don't have to make a new one?

      Thanks!

       
      • TNTEverett

        TNTEverett - 2006-02-20

        Give me the email address.  If you don't want to send the exact email address do this;
        replace letters with letters, numbers with numbers, use all exact special characters . _ etc..
        I you want to send the exact email don't post it here, send it to me in an email.

         
    • ladybirdie

      ladybirdie - 2006-02-20

      I just send you a mail with the exact adress in it.

       
      • TNTEverett

        TNTEverett - 2006-02-20

        Change the email check function to this:
        The modification is in the 3rd set of []'s.

        if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9_\\-]+)*"."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){

         
    • ladybirdie

      ladybirdie - 2006-02-20

      I must be doing something wrong, I followed your steps, uploaded again, but it still doesn't work... I think I'm making a mess of it, and PHP is totally new for me, but I want to learn!

      This is the first part of the process.php. file now:

      <?php
      include("global.inc.php");
      $errors=0;
      $error="The following errors occured while processing your form input.<ul>";
      pt_register('POST','Naam');
      pt_register('POST','Email');
      $Email=trim($Email);
      pt_register('POST','Telefoonnummer');
      pt_register('POST','Website');
      pt_register('POST','Vragenofopmerkingen');
      $Vragenofopmerkingen=preg_replace("/(\015\012)|(\015)|(\012)/","&nbsp;<br />", $Vragenofopmerkingen);if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9_\\-]+)*"."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){
      $error.="<li>Invalid email address entered";
      $errors=1;
      }

      Since I didn't know for sure where to put all the files exactly, I have the 'public html-folder', where I put the projectfiles, but in this public html-folder I also have the folders 'phpform', 'admin' and 'files'. Within these folders are also the process.php and form1. I made the changes in all 3 process.php files in the different folders.
      So I have some things 'double', do you know what I mean? I can probably delete some of them, but I would like the form working correctly before I look into that.

       
      • TNTEverett

        TNTEverett - 2006-02-20

        First of all you should only modify the process.php file that is in the same directory as the form you wish to modify (Nothing else!). 
        Second it looks like you put the modification in the right place.
        I tested this modification myself so I know it works.  Maybe you are not modifying the right file. 
        The phpform directory is where the form generator is located.
        The phpform/forms/use directory is where new forms are put by the generator.  For instance, if your form name was MyForm it would be located in the directory named
        phpform/forms/use/MyForm
        You will find the form1.html and the process.php file in this folder along with a number of other files and folders.  This is where you should be making your modifications. 

        Send me a link to your form. 
        Add this text to your process.php file.

        Replace this line
        $error.="<li>Invalid email address entered";
        with this line
        $error.="<li>Invalid email address entered:".$Email;

        When you enter an invalid email the next time you should see the wrong email addres appear after the Invalid... text.  If this does not occur you have modified the wrong file. 

         
    • ladybirdie

      ladybirdie - 2006-02-20

      That's weird, I just tested with a fake mailadress with an _ : this one 'lady_lady@lycos.nl' and then it does work.

      So when the _sign is in the middle at not before the @ it works properly.

      Maybe this helps finding an solution?

       
    • ladybirdie

      ladybirdie - 2006-02-20

      I modified the file, this message appears now:

      The following errors occured while processing your form input. Invalid email address entered: hermail_@hotmail.com

      (I changed it for her privacy, but it's the adress I send you earlier. I've send the link to the form in a email (or should I've put it here?)

      p.s. I deleted the other 'double' folders, I think I did it correctly, because it all still works :-)

       
      • TNTEverett

        TNTEverett - 2006-02-21

        OK so show me again how you modified this file with the change I gave you. 
        This change should work.  I'm just not sure why it does not work for you.

         
      • TNTEverett

        TNTEverett - 2006-02-21

        I think I see what happened.  Give me a minute to make a change.

         
    • ladybirdie

      ladybirdie - 2006-02-21

      Wow! Your still helping me out, you're the best!

      I received two mails just now! With two mailadresses, one with two _ signs , and one without it

       
    • TNTEverett

      TNTEverett - 2006-02-21

      OK, when I was testing I added one underscore that I know would work with the old check function.  Then I added the second underscore to check the new function.  What I failed to do is remove the first underscore after testing the second successfully.  The failure occured again because you only had one trailing underscore (the condition I missed). 
      Try this modification to the last check function.

      Change the email check function to this:
      The modification is in the 3rd set of []'s.

      if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+[_\\-]*)*"."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){

       
    • ladybirdie

      ladybirdie - 2006-02-21

      I'm becoming crazy, I still get the message with the entered mailadress in it. I don't know if you need to see it, but I'll paste my process.php again:
      <?php
      include("global.inc.php");
      $errors=0;
      $error="The following errors occured while processing your form input.<ul>";
      pt_register('POST','Naam');
      pt_register('POST','Email');
      $Email=trim($Email);
      pt_register('POST','Telefoonnummer');
      pt_register('POST','Website');
      pt_register('POST','Vragenofopmerkingen');
      $Vragenofopmerkingen=preg_replace("/(\015\012)|(\015)|(\012)/","&nbsp;<br />", $Vragenofopmerkingen);if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+[_\\-]*)*"."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){
      $error.="<li>Invalid email address entered:".$Email;
      $errors=1;
      }
      if($errors==1) echo $error;
      else{
      $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
      $message="Naam: ".$Naam."
      Email: ".$Email."
      Telefoonnummer: ".$Telefoonnummer."
      Website: ".$Website."
      Vragen of opmerkingen: ".$Vragenofopmerkingen."
      ";
      $message = stripslashes($message);
      mail("mymail@lycos.nl","Form Submitted at your website",$message,"From: phpFormGenerator");

      header("Refresh: 0;url=http://www.vincents.nl/bedankt.htm");
      ?><?php
      }
      ?>

       
    • ladybirdie

      ladybirdie - 2006-02-21

      This is really weird, I also tried the fake mailadress that you used earleir, just to be sure it also works when  I try it, her_mail_@hotmail.com... And than one also works, just still not the one I send you

       
      • TNTEverett

        TNTEverett - 2006-02-21

        OK, fails for me to.  Let me use this one as an additional test case.

         
      • TNTEverett

        TNTEverett - 2006-02-21

        Third time's the charm.  It's best to cut and paste so you don't miss anything.  Just be careful of line breaks.  This should be one continuous line. 

        if(!eregi("^[a-z0-9]+([_\\.-]*[a-z0-9]*)*"."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){

         
    • ladybirdie

      ladybirdie - 2006-02-21

      Thanks for your help anyway! I'll check into Paypal, because I should really donate something after tonight! As long as you try to find the problem :-)

      But what's best to do now? Maybe my sister is the only one with such a weird mailadress, but I can't risk the mail not working when unknown visitors get this message while entering their adress...

      Create a new form and make it a text box instead of email? Or can I make this change in the existing form?

      I hope you'll find the solution when you use this as an test case! I'm actually kind of releived that I wasn't being totally stupid! How will I know if you've found the solution?

      Ok, unfortunaly without the solution... it's bedtime, it's 3.15 here and I have to get up early :-(

       
    • ladybirdie

      ladybirdie - 2006-02-21

      Hi TNTEverett,

      Amazing! Could it be that I found the solution?? I didn't want to give up, but I don't know anything about PHP and all the codes, so I was just trying some things in de changes you gave me last night. And the first thing I tried was this change:

      if(!eregi("^[a-z0-9]+([a-z0-9]+[_\\-]*)*"."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){

      I deleted the second set of []'s of the last you gave me last night:
      if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+[_\\-]*)*"."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){

      And now I get all the mails from the fake adresses like her_mail_@hotmail.com, her_@hotmail.com, her_mail@hotmail.com. It doesn't seem to matter now where the _ is.

      Is this the right modification? Or am I breaking any 'php-rules' with this one?

       
      • TNTEverett

        TNTEverett - 2006-02-21

        if(!eregi("^[a-z0-9]+([_\\.-]*[a-z0-9]*)*"."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){

        This is the one that should work.  Did you try this one?

         
    • ladybirdie

      ladybirdie - 2006-02-21

      Finally it works!

      My solution wasn't that great, because I found out while testing than the mailadresses with a . didn't work...

      Yours works! Thank you so, so, so much! 

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.