i can't find a good code to check if e-mail exists. im trying to do this with cdo. maybe someone could sugest some source?
or maybe could help to make it...
here is what im trying to do

<%
Dim iMsg
Dim iConf
Dim Flds
Dim strHTML
set imsg = createobject("cdo.message")
set iconf = createobject("cdo.configuration")
Set Flds = iconf.Fields
With Flds
.Item("") = 2
.Item("") = "<SMTP Server>"
.Update
End With
strHTML = "<HTML>"
strHTML = strHTML & "<HEAD>"
strHTML = strHTML & "<BODY>"
strHTML = strHTML & "<b> This is the test HTML message body</b></br>"
strHTML = strHTML & "<hr>"
strHTML = strHTML & "This another section of the message...</BR>"
strHTML = strHTML & "</BODY>"
strHTML = strHTML & "</HTML>"
With iMsg Set
.Configuration = iConf
.To = "<valid e-mail address>"
.From = "<valid e-mail address>"
.Subject = "This is a test CDOSYS message (Setting DSN options)"
.HTMLBody = strHTML
.fields("urn:schemas:mailheader:disposition-notification-to") = "<valid e-mail address>"
.fields("urn:schemas:mailheader:return-receipt-to") = "<valid e-mail address>"
.DSNOptions = cdoDSNSuccessFailOrDelay
.DSNOptions = 14
.fields.update
.Send
End With

i'm sending message to the e-mail i want to check for validation. and i can get confirmation that mail was sent succesfuly. but the problem is that i get it by mail. i want to check if e-mail is valid in the source code. if its possible

thank you

Dani AI

Generated

Short answer: there is no foolproof, server‑side way in Classic ASP to prove an address "exists." 's CDO send produced a bounce message later because many MTAs accept mail during the SMTP session and generate DSNs asynchronously; only when the recipient server rejects at the RCPT stage will a synchronous error be available. 's whois suggestion checks domain registration but is weaker than a DNS/MX check for mail routing.

A practical, layered approach that balances reliability and safety:

  • Step 1 — syntactic check: fast client/server regex to reject obviously invalid addresses. Example VBScript (Classic ASP) for format checking:
Function IsValidEmail(addr)
  Dim re
  Set re = New RegExp
  re.Pattern = "^[A-Za-z0-9._%+\-]+@[A-Za-z0-9.\-]+\.[A-Za-z]{2,}$"
  re.IgnoreCase = True
  IsValidEmail = re.Test(addr)
End Function
  • Step 2 — DNS/MX lookup: confirm the domain has MX (or A) records. Classic ASP has no built‑in DNS API, so many people call nslookup via WScript.Shell or use a small native DLL/service to get MX hosts. Beware of server permissions when invoking shell commands.

  • Step 3 — SMTP RCPT probe (optional, fragile): open a TCP connection to the domain's MX on port 25 and run an EHLO/MAIL FROM/RCPT TO sequence. A 250 on RCPT TO suggests the server accepted the recipient; 550 or similar indicates rejection. Example SMTP reply flow:

220 mx.example.com ESMTP
EHLO validator.example.com
250 mx.example.com
MAIL FROM:<validator@domain.com>
250 OK
RCPT TO:<target@domain.com>
250 OK   <-- accepted  OR  550 No such user <-- rejected

Caveats: many servers accept everything (catch‑all), use greylisting, or silently defer bounces; probing can trigger rate limits or blacklistings. For reliable production validation the recommended, industry‑standard solution is an explicit confirmation email containing a unique activation link. For bulk or real‑time needs, third‑party validation services exist (they combine MX checks, SMTP probes and historical data) but carry cost and privacy considerations.

Recommended Answers

All 3 Replies

There is no way to check that a email address exists in ASP. The only thing you could do is a "whois" on the domain to make sure it is real, but that is about all you can do.

could you shoe an example of this?

I can never actually needed to code this but you could probably take a look at this and recode it so check for the email domain of the user and make sure it is valid.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.