Jump to content

Checking the validity of an email address - (Moved)


Recommended Posts

I have a client that sends millions of emails monthly.  His has a valid opt-in and opt-out in place. I even wrote him a script that checks the validity of the email address with respect to the format. I even download a list of the Top Level Domains (TLD's ie.  .com, .net, .org. etc.) as a part of my check (http://data.iana.org/TLD/tlds-alpha-by-domain.txt) He routinely removes people that unsubscribes and removes bounced email addresses.

 

The other day he asked me if there was a way to validate the email address by checking the email address against the domain’s MX and DNS records to see if that user exists before the email is added to his list.

Link to comment
Share on other sites

  • Developers

Moved to the appropriate forum, as the AutoIt Example Scripts forum very clearly states:

Quote

Share your cool AutoIt scripts, UDFs and applications with others.


Do not post general support questions here, instead use the AutoIt Help and Support forums.

Moderation Team

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Hi.

You can check DNS record this way:

Local $sDomain = "autoitscript.com"
_CheckDomain($sDomain)
If @error Then
    MsgBox(0, 'Error', "Domain not found.")
Else
    MsgBox(0, 'Success', $sDomain & " exists.")
EndIf

Func _CheckDomain($sDomain)
    TCPStartup()
    TCPNameToIP($sDomain)
    If @error Then
        TCPShutdown()
        Return SetError(1)
    EndIf
    TCPShutdown()
    Return 1
EndFunc

Regards, Simpel

SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win_10   Build = 19044   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Link to comment
Share on other sites

Most SMTP servers do check the RCPT TO: adress before accepting the DATA: part of the protocol.
Here's an example:

here login protocol, then
"MAIL FROM:<user123@mydomain.mytld>\r\n"
"250 ok\r\n"
"RCPT TO:<destinee@hisdomain.histld>\r\n"
"250 ok\r\n"
"DATA\r\n"
"354 go ahead\r\n"

Check that you get the 250 status and cancel the session.

The issue is that not all servers follow the RFC, e.g. gmail.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

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...