We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6726
    • 7,075 Posts
    For the record I have asked this on TXnewsletter support thread a while back with no success.

    TXnewsletter email validation does not accept email such as [email protected].
    If there are no . _ - in their address = they can’t subscribe.

    Around line 250 :

    // TESTE VALIDITE EMAIL                   
    unset($email_invalid[$i]);
    $valid = false;
    if ((preg_match(’`^[[:alnum:]]([-_.]?[[:alnum:]])*@[[:alnum:]]([-_.]?[[:alnum:]])*\.([a-z]{2,4})$`’,$data))){
    //Uncomment to activate DNS check for email domains
    //$domaine = substr(strstr($data, ’@’),1);
    //if (checkdnsrr($domaine)){$valid= true;}
    $valid = true;
    }

    I think it has to do with the part in red :
    preg_match(’`^[[:alnum:]]([-_.]?[[:alnum:]])*@[[:alnum:]]([-_.]?[[:alnum:]])*\.([a-z]{2,4})$`’,$data)

    But I can’t write regular expressions could somebody help out ?
    Maybe adapt eForm validation scheme (see bellow) to TXnewsletter ?

    case "email":
    //stricter email validation
    if (strlen($value)>0 &&!preg_match(
    ’/^(?:[a-z0-9_-]+?\.)*?[a-z0-9_-]+?@(?:[a-z0-9_-]+?\.)*?[a-z0-9_-]+?\.[a-z0-9]{2,5}$/i’, $value) ){
    $vMsg[count($vMsg)]=$desc . $_lang["ef_invalid_email"];
    $rClass[$name]=$invalidClass;
    }

    TXnewsletter is really great - since you can use it to automatically build newsletters from MODx documents, pretty handy with Ditto calls - it’s too bad an email validation scheme ruins a key part of it undecided

    Thanks !
      .: COO - Commerce Guys - Community Driven Innovation :.


      MODx est l'outil id
      • 6726
      • 7,075 Posts
      Sorry to bump but anyone can help me here ?
        .: COO - Commerce Guys - Community Driven Innovation :.


        MODx est l'outil id
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        There’s a million regexp for validating email.

        How about just using one from eForm or one of the other snippets that validates email?
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 3749
          • 24,544 Posts
          Here are a couple of typical ones:

          if (!preg_match("/^( [a-zA-Z0-9] )+( [a-zA-Z0-9\._-] )*@( [a-zA-Z0-9_-] )+([a-zA-Z0-9\._-] +)+$/" , $data)) { 
          $valid=true; 
          }

          if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $data)) {
          $valid=true;
          }


          It’s likely that some valid email addresses would fail these, however. If you really want to do it right, look here:

          http://www.linuxjournal.com/article/9585
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 7231
            • 4,205 Posts
            I would just replace it with one that works. I get lost with the POSIX stuff, but I am sure that there is a missing tag in there.
            here is a nice read: http://www.regular-expressions.info/email.html
              [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

              Something is happening here, but you don't know what it is.
              Do you, Mr. Jones? - [bob dylan]
              • 6726
              • 7,075 Posts
              Thanks guys !

              I will try those and report... looks like it’s time to document myself a bit more on email validation, I’ll follow those links smiley
                .: COO - Commerce Guys - Community Driven Innovation :.


                MODx est l'outil id
                • 10323
                • 35 Posts
                Bonjour David,

                I’m considering TXNewsletters - so I’m curious: did you get email validation to work?
                  • 6726
                  • 7,075 Posts
                  No I did not, I dropped the matter in favor of poMMo, to little time to play with this... real shame, since it’s the only problem with TXNewsletter...
                    .: COO - Commerce Guys - Community Driven Innovation :.


                    MODx est l'outil id
                    • 12422
                    • 29 Posts
                    Doesn’t anybody have a valid fix for TXnewsletter?
                    It’s a real cool module, but the validation bug makes it more or less unusable sad