Jump to content

Check The Existance of a Domain - (Moved)


XanzyX
 Share

Recommended Posts

I have a client (healthcare provider) that has a HUGE database (28 million records).  They need to send out a mass email to their clients, both past and present.  They want me to check all the emails addresses for valididy. I wrote a function that checked to domains to see if they exist.

I wrote:

Func _CheckDomain($sDomain)
   TCPStartup()
    If TCPNameToIP($sDomain) <> "" Then
        Return 1
    EndIf
    TCPShutdown()
     If Ping($sDomain) > 1 Then
        Return 1
    EndIf
    Return 0

EndFunc   ;==>_CheckDomain

I checked the results agaimst GoDaddy.com's Bulk Domain search to fimd a number of the domains that the function marked as non-existant were "Taken".  I took those domain names and plugged them into a broswer to find that the domain, infact existed.    

I added:

If StringLen(_INetGetSource($sDomain)) > 1 Then
    Return 1
EndIf

I got even less "Taken" domains, but none the less I can't capture only the invalid domains.

I even added:

If StringLen(_INetGetSource("http://" & $sDomain)) > 1 Then
    Return 1
EndIf

If StringLen(_INetGetSource("https://" & $sDomain)) > 1 Then
    Return 1
EndIf

 

I got a better result.

Am I missing something? Is there a sureshot way to check a domain's existance?

 

 

 

 

 

Link to comment
Share on other sites

Did you search the forum? IIRC this subject has been discussed a few times.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

IIRC isn't a place it is an abbreviation for: If I remember correctly
I will search as well and post my findings here
:)

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

What exactly do you mean by "Active Directory domains"?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Have you tried NSLOOKUP or is this blocked by your security systems?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I found out, in other forums that to increase the timout to at leasr 700 and you will get better results,

    If Ping($sDomain, 700) > 1 Then
        Return 1
    EndIf

I reran the script and I recieved way better results.  The domains that were "Taken" were not in use.

Thanx again

QED

Link to comment
Share on other sites

  • Moderators

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions. If it's super geeky and you don't know where to put it - it's probably here.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

3 hours ago, XanzyX said:

They want me to check all the emails addresses for valididy. I wrote a function that checked to domains to see if they exist.

Obviously you spent no time trying to Google the subject of checking the existence of email addresses.

First and foremost, trying to check the validity of an email address by verifying the existence of the email address' domain is like trying to check the validity of a specific street address by verifying that the street exists. 

Probably the best way to check the validity of a specific email address, but still not 100% foolproof, would be to write a function that queried for the domain's MX record and then started a SMTP conversation with the MX server to see if you get a valid response from the "rcpt to:" command. But like I said, that may not work 100% because of security measures.  Also, most ISPs these days block port 25 (SMTP) for outbound connections.  If yours is one of them, you will need to establish a SSL/TLS connection over the appropriate port for the SMTP server.  Of course you could always use an email address verification service that has an API for you to consume.

To be honest, there is no foolproof way to verify that any particular email address exists.  If it is a mass mailing, why would you even try?  If your "client" really wants stats about bounce backs, blocks, and the like, use a mass mailing service like SendGrid which can capture those sort of mass mailing stats for you.  Why try to reinvent the wheel? 

Edited by TheXman
Corrected typo
Link to comment
Share on other sites

Checking the validity of an email address by verifying the existence of the email address' domain is like trying to check the validity of a specific street address by verifying that the city the street address is in.

Already I found 4,000 dead domains that will not have an email address attached yrt.

Getting the MX records require a valid email address, signed in with a password.  This is not something I can compile and offer other users.

 

Link to comment
Share on other sites

5 minutes ago, XanzyX said:

Getting the MX records require a valid email address, signed in with a password.

You obviously are in way over your head and haven't a clue what you're talking about as it relates to DNS or SMTP.  Getting the MX record(s) for a domain does NOT require a valid email address or a password.  It is merely querying DNS for the MX record of the email address' domain.

You appear to be trying to perform surgery when you haven't even finished high school.  What makes it worst, is that you think you actually know what you are talking about,  :muttley: 

Good luck with your little endeavor.  Hopefully someone else will take you by the hand and try to help you learn the basics of DNS and SMTP.  Until then, keep :mad2:

 

Link to comment
Share on other sites

Thank you. 

You are so kind. 

You should coach Little League

Not one bit of code to share
Not one bit of encouragement
Not one bit of ideas or helpful advice
Only harsh criticism which was a backhanded way to exult yourself
You smugly proclaim that I “Obviously are in way over your head and haven't a clue what you're talking about” as if you are the only one that has an idea
Did you try to help me with a code line or two?
Did you offer your vast knowledge to me and to others that have the same questions?

No!

You told everyone in this forum how arrogant and self-righteous you are.

I would hate to see how you would give advice to a 14 year old child trying to start out with coding in AutoIT.

You, are obviously in way over your head and you haven’t a clue how to help others in a humble manner.

Edited by XanzyX
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...