SitePoint Sponsor

User Tag List

Results 1 to 13 of 13
  1. #1
    SitePoint Evangelist
    Join Date
    Apr 2004
    Location
    Boston
    Posts
    482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    email address validation

    Does anyone know of a fairly easy way or can direct me to a tutorial for email address validation, I am not looking for syntax validation rather to see if the domain and username are valid.

    One note: I am using IIS 6.0 not Apache.

    Thanks.

  2. #2
    SitePoint Enthusiast WMX's Avatar
    Join Date
    Sep 2008
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What exactly do you mean by checking if the domain and username are valid? You mean you want to check if the email address actually exists? For some purposes it is ok to just check for the presence of a '@' to see if the text looks like an email address for other purposes, you would want to use a (long) regular expression to actually validate the email address according to the RFC.
    ~

  3. #3
    Coding and Breathing CoderMaya's Avatar
    Join Date
    Feb 2008
    Location
    Atlit, Israel
    Posts
    470
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I believe he wants to try to connect to the email address to verify that it's actually in use.

    Well, save yourself the trouble. Robots have ways beyond that, as well.

    Just use e-mail verification, it's your best chance to avoid them.
    Learn about the new Retro Framework
    Code PHP the way it was meant to be coded!

  4. #4
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Trying to ask whether or not a specific email at a certain domain will yield inconsistant results. Sometimes, the reply you get will always be true whether the email actually exists or not.

  5. #5
    SitePoint Evangelist
    Join Date
    Apr 2004
    Location
    Boston
    Posts
    482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by WMX View Post
    What exactly do you mean by checking if the domain and username are valid? You mean you want to check if the email address actually exists? For some purposes it is ok to just check for the presence of a '@' to see if the text looks like an email address for other purposes, you would want to use a (long) regular expression to actually validate the email address according to the RFC.
    I have a list of 30000 prospective clients and I want to send an email to them in chunks. I have already sent 200 but I got 115 bounce backs stating that the email address and/or domain was invalid.

    I was hoping that I could pre filter the names using a script and flag them in my database to identify whether or not they are valid email addresses so the next time I send a chunk of emails it will target only those known to be real.

  6. #6
    SitePoint Enthusiast WMX's Avatar
    Join Date
    Sep 2008
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think the best you can do is validate the addresses to see if they look like valid addresses as the first step. But even if they look valid, some may not be actual addresses on the target server. Depending on your setup, you could potentially have a way to track bounces and if an address bounces, flag it in your database. But that's no small undertaking.
    ~

  7. #7
    SitePoint Evangelist
    Join Date
    Apr 2004
    Location
    Boston
    Posts
    482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by WMX View Post
    I think the best you can do is validate the addresses to see if they look like valid addresses as the first step. But even if they look valid, some may not be actual addresses on the target server. Depending on your setup, you could potentially have a way to track bounces and if an address bounces, flag it in your database. But that's no small undertaking.
    Yeah that is what i was afraid of, the amount of time it would take to do that is not worth it. The format of the addresses are all valid, that i know how to check. does the
    PHP Code:
    checkdns() 
    function work in IIS? I tried playing around with it but couldnt get it to work. I guess if I just check the dns that is a start.

  8. #8
    SitePoint Enthusiast WMX's Avatar
    Join Date
    Sep 2008
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I suppose you could check dns records for the email's domain, and not send email if there are no dns records. I wouldn't check for mx records to verify the email, I would check for *any* dns records, and if there are none, assume it's a non-existent domain. For that I'd use dns_get_record on php 5.
    ~

  9. #9
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    New one on me, thanks WMX.

  10. #10
    SitePoint Evangelist
    Join Date
    Apr 2004
    Location
    Boston
    Posts
    482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by WMX View Post
    I suppose you could check dns records for the email's domain, and not send email if there are no dns records. I wouldn't check for mx records to verify the email, I would check for *any* dns records, and if there are none, assume it's a non-existent domain. For that I'd use dns_get_record on php 5.
    Thanks WMX

  11. #11
    SitePoint Enthusiast WMX's Avatar
    Join Date
    Sep 2008
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Using DNS to try to see if a server will accept email is tricky at best, since a domain can receive email without having any MX records for example.
    ~

  12. #12
    SitePoint Evangelist
    Join Date
    Apr 2004
    Location
    Boston
    Posts
    482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    get_dns_record() doesnt work on IIS. Anyone know of an alternative?

  13. #13
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    The answer is on my off-line manual page, here too dns_get_record.

    There is a PEAR class called NET_DNS.

    Some hero has back-ported the function for PHP4, that's in the user notes on the man.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •