Virtual Fab Email address Checker 1.0


Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame

Environment: VB6 SP4, NT4 SP5


This VB6 COM component provides realtime Email address checking. This is useful when you want to avoid sending Emails to non-existent accounts. For example, in an ASP page you can check if the user typed his Email address correctly, avoiding storing a wrong information in your users database.


  4. USAGE


Giving an Email address (e.g. someone@somewhere.com), it executes the following steps:

  1. Separates the Username (someone) from DomainName (somewhere.com);
  2. Queries the configured DNS server if DomainName is valid (exists);
  3. If DNS answers, it tries a SMTP (Simple Mail Transfer Protocol) session with each MX (Mail Exchanger) in that domain, as resulted from DNS query, until a session can be established;
  4. Using SMTP, it verifies that Username exists on that domain, both using the VRFY (verify) command, and a true mail handshake (HELO, MAIL FROM, RCPT TO);
  5. It then returns the result of its search, giving 4 possible results:
    • The domain doesn't exist. Negative answer
    • The domain exists, but it isn't possible to check username (see note 1). Partially positive answer.
    • The domain exists, but the username doesn't exist. Negative answer
    • Both the domain and the user exist, fully positive answer

Note 1: If the domain exists, but the MX Mail Exchangers aren't in that domain (typical situation with secondary domains handled by ISPs), it's no use to check via SMTP since those machines are instructed to accept all mails for subdomains, and don't check username at all. So we stop and take the partially positive answer.


This component

  • Finds DNS server as configured on the local machine. You must have an active connection to the internet for this component to work properly
  • Sends DNS requests using the SimpleDNSResolver component (see credits below)
  • Receives DNS answers via UDP
  • Establishes an SMTP session, via a standard Winsock.ocx TCP connection
  • Talks with remote mail server to find out information on user
  • Provides complete session log (DNS and SMTP) for debugging
  • Provides very small executable (it is an ActiveX DLL less than 50K in size)
  • It hasn't an user interface and must be used by any language that supports ActiveX components (e.g. VBScript, ASP, VB, VC++, etc...)
  • Runs on Windows NT 4.0 SP5, Windows 2000 (not tested), Windows 95 (not tested) and Windows 98 (not tested)
  • Compiles with VB 6.0 Service Pack 4 (tested), but it can be compiled also in previous VB versions (such as 5) that support Winsock.ocx


  • Download the package, unzip it into your preferred directory;
  • Copy the VfabEmailUtils.DLL into your SYSTEM directory (C:\WINNT\SYSTEM32 for Windows NT, or C:\WINDOWS\SYSTEM for Win9x)
  • Register the component into the registry:
    • REGSVR32 C:\WINNT\SYSTEM32\VfabEmailUtils.dll
  • IMPORTANT: to have this component working properly, you MUST install Emmanuel KARTMANN's Simple DNS Resolver v1.0. Please click here to read about how to install his package. See credits below.


To use this component:

  • Create an instance of the component;
  • Put properties:
    • EmailAddr
    • SmtpTimeOut
    • DNS server address (only under Win9x)
  • Call the CheckDomain method
  • Test the Result property: if it is not equal to vfabInvalidDomain (1) then you can
  • Call the CheckUserName method;
  • Then test the Result property to get the final result:
    • vfabNotVerified = 0
    • vfabInvalidDomain = 1
    • vfabValidDomain = 2
    • vfabValidDomainInvalidAccount = 3
    • vfabValidDomainValidAccount = 4

SAMPLE CODE (VBScript from an ASP page)

dim oVfab
set oVfab=CreateObject("VFabEmailUtils.EmailCheck")  'Create object
oVfab.EmailAddr = Request.Form("EMAIL")  'Get the address to check
                                         'from ASP and assign it
                                         'to object
oVfab.CheckDomain                        'Check if domain exists
If oVfab.Result <> 1 Then                'If it exists, then try 
                                         'to check also UserName
oVfab.SmtpTimeOut = 10                   'Give the object 10 seconds
                                         'to connect to remote SMTP
  oVfab.CheckUserName                    'Tries the SMTP session
End If
Response.Write "<br>" & oVfab.Log (true) 'Displays session log
                                         'in HTML format
Select Case oVfab.Result
Case 1
  Response.Write "Domain name (<b>" & oVfab.DomainName & _
                               "</b>) <b>INVALID</b>"
Case 2
  Response.Write "Domain name: valid - Cannot check account<br>"
Case 3
  Response.Write "Domain name: valid - Username (<b>" & _
                                                 oVfab.UserName & _
                                                 "</b>) <b>INVALID</b>"
Case 4
  If oVfab.RealName <> "???" Then
    Response.Write "Domain Name: valid - Account verified - _
                    Real name: " & _
                    oVfab.realname & "<br>"
    Response.Write "Domain Name: valid - Account verified<br>"
  End If
End Select
oVfab.Clear    'Clear connections, logs, and status



Name Description
CheckDomain() Checks the domain part of the Email address to see if it is a valid (existent) domain
CheckUserName() Checks the username via SMTP to see if it is a valid mail account on that domain
Clear() Clear connections, status and log after having completed the task


Name Type Read Write Description
EmailAddr String Yes Yes Specify the Email address to check
Result Integer Yes No Get the result of CheckDomain() and/or CheckUserName()
SmtpTimeOut Integer Yes Yes Get/set the timeout in seconds to wait for an SMTP connection
DnsServer String Yes No Set the DNS server IP address to use. Mandatory under Win9x, optional in Windows NT
RealName String Yes No Get the User's Real Name if provided by the SMTP server, after CheckUserName()
DomainName String Yes No Get the domain part of EmailAddr
UserName String Yes No Get the username part of EmailAddr
Log(blnHTML) String Yes No Retrieves the session log, complete with all messages exchanged between the client and the servers. If the optional parameter blnHTML is set to true, it reformat the log with HTML line breaks for an easier reading
SmtpServer String Yes No Get the complete list of MX servers for the domain


This component strongly relies on SimpleDNSResolver by Emmanuel KARTMANN. Please refer to his page for details on the DNS architecture and on his component.

Download Zipped Project Files (28k)


  • Some Considerations

    Posted by Legacy on 11/24/2002 08:00am

    Originally posted by: Dario

    thank's to Fabio's code we have a nice starting point for a really fail-proof e-mail checker. I think he coded this for his situation and didn't intend to use it for cehcking mailboxes that were outside his domain. Actually the CheckDomain function will not do anything if the mailbox is not in your domain. Furthermore the SMTP connection made is not RFC-821 compilant, you need to specify the MAIL FROM and RCPT TO address in this form: RCPT TO:<someone@somewhere.tld> , otherwise the mail server will refuse it. Another error I've noticed is that the function will not check the next SMTP server if the first one is not responding.

    We should also make a spelling check (invalid characters etc.) of the email address before calling CheckDomain.

    We don't need the Simple DNS Resolver if we are on a windows NT matchine with WSH 2.0 installed. We can simply execute "nslookup -querytype=mx domain.tld dnsServer" from the WScript.Shell and get the mail exchangers from there.

    One last point I have to underline is that the only way to check if the mailbox is 100% valid and ready to recive is to realy send a message to it. The reason is that some mail servers (ex. yahoo) will reply to "RCPT TO:<someone@somewhere.tld>" with "250 OK" even if the mailbox is not valid. In this case the only thing you can do is go ahead and send some "DATA" and finish the message with a "." , after this the server will reply with "250" and you are 100% shure the mailbox is valid.

    That's all, if you have any questions or more ideas feel free to contact me.


  • Re: CSimpleDNSClient

    Posted by Legacy on 08/19/2002 07:00am

    Originally posted by: sachin

    'Hope this coding helps..
    'set a reference to the dll file in the project
    ' set the domain value to tstr
    'for ex: tstr="eth.net"

    Dim oDNS As SimpleDNSClient
    Dim tStr As String

    'Set oDNS = CreateObject("Emmanuel.SimpleDNSClient.1")
    Set oDNS = New SimpleDNSClient

    Dim server_name
    Dim requested_name
    Dim separator
    separator = ","
    Dim found_names
    found_names = ""

    ' Set the server address(es) [optional on Windows NT, mandatory on Win95/98]
    oDNS.ServerAddresses = server_name

    oDNS.separator = separator

    On Error Resume Next
    oDNS.GetEmailServers tStr, found_names
    If Err <> 0 Then
    MsgBox Err.Description
    MsgBox "Found names:" & vbCrLf & vbCrLf & found_names
    End If

  • CSimpleDNSClient.dll

    Posted by Legacy on 07/26/2002 07:00am

    Originally posted by: PreetiRathore

    Can I create CSimpleDNSClient.dll in Visual Basic 6.0. Emmamunel's code is in C++. Please help me to incorporate this code in vb

    Please help

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date