[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 178
  • Last Modified:

validate e-mail addr. / url

Hi !
How can I check if a website exists and if an e-mail adress is correct (for e-mails the @ is enough) ?

regards
ItsMe
0
ItsMe
Asked:
ItsMe
  • 2
  • 2
1 Solution
 
KennyIT Application ExecutiveCommented:
Perhaps you can try to redirect to that website, and if successful, the site exist, else it does not.
0
 
furuCommented:
Mail:
There is no 100% way to check e-mail addresses. Not possible, not even close to usable.

There are way to check for e-mail address validity according to the RFC's, but, alas, the RFC's are not the only addresses that work. Also, if you validate according to what might be theoretically correct, you'll end up validating addresses like -@ (yes, that _is_ a theoretically correct mailaddress). Using advanced Regular Expressions (available in most programming languages) you can check if a mailaddress is likely to be valid. You can then use some SMTP-module or telnet to guess if the mailaddress will accept your mail.

Web:
If you are using a language like Perl (or many others( you might look at the libwww-modules (LWP for perl) for checking if a site is available. You can not check if it exsist this way because a site may exsist without being available.

The morale is: It's not 100% possible. Somewhat close to 50%, I would guess, and if you can live with that, follow the leads above for more info...
0
 
ItsMeAuthor Commented:
Hi furu ! Ok, I will check for the @ to check the mail adress but tell me, isn't it possible to open a link with perl and read the content somewhere in ? I'm new in Perl. If I would develop an delphi (my language) application I could read the URl into a string...then I knew this is an html document, the url is ok.

regards
ItsMe
0
 
furuCommented:
Yes, you can, but it won't be 100% safe. How do you know that the site isn't just temporary overloaded or that there is some network problem between you and the other site.

My point is that although you may be able to validate a site's exsistance by connecting to it, you will not be safe that a site does _not_ exsis if you can't connect to it.

Same way, a regexp of
m![a-zA-Z][\w\@]*\@([\w\@]+\.)+([\w\@])!
would probably more or less validate a mailaddress, but there is no way to make sure that the mailaddress is working.
0
 
ItsMeAuthor Commented:
Its enough for my purposes to check the @...

thanks
ItsMe
0

Featured Post

2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now