#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Posts
    44
    Rep Power
    15
    Hi, I have a table of user inputed e-mails and a lot of them haven't put correct e-mails in. When I use the
    mail(email, blah, blah); command and loop through all of them, it stops on some of them giving me errors.

    How would I either:
    1. Bypass it so that it doesn't stop on false e-mails
    2. Clean up the table and remove e-mails that will stop it.

    When i try to run the command "select email from users where email = '%@%';" I get an empty set, even though there are over 500 e-mails in there.

    Can someone tell me what an e-mail address requires to be processed correctly? Also, why isn't the wildcard working? Is my syntax correct?

    Thanks.

    Decius

    Undergrounds.com - Free Model and Actress Picture Resource http://www.undergrounds.com/
    -----------------------------------------
    Over 6000 pictures for over 150 beautiful
    women. Including actresses, models, and
    singers, our oceanic galleries are all
    alphabetically filled with high quality
    images.
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    You must use LIKE not = when using wildcards. Also, I'd recommend using this pattern "%@%.%"

    That should stop mail() from complaining, even if the address isn't valid.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 1999
    Location
    Annapolis, Maryland US
    Posts
    113
    Rep Power
    15
    Here's a select that gets all valid (syntactically) email addresses from your table. Whether or not they actually exist, that's another matter....

    select * from table
    where email regexp '([_.0-9a-z-]+@)([0-9a-z][0-9a-z-]+.)+([a-z]{2,3})';

  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Posts
    44
    Rep Power
    15
    Thanks. :-)

    Works like a charm. One question Kyuzo...
    Your select statement allows email addresses such as blah@blah to be passed, without a .com etc.

    Is this your intention? Or should I configure it so that it checks for a .com too?

    Thanks.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 1999
    Location
    Annapolis, Maryland US
    Posts
    113
    Rep Power
    15
    Decius,

    Are you sure about that??? I changed an email in one of my tables to blah@blah ;-) and the select statement didn't pull it out. The final part of the regular expression ( the .)+([a-z]{2,3})'; stuff...) should check for a .com, .org, .net, .jp, .de, dot just about anything. Give it a shot again and let me know if it doesn't work -- I'll be surprised if it doesn't....

    Regards,

    Kyuzo

IMN logo majestic logo threadwatch logo seochat tools logo