Validation on email address

D

David, the great

Hi,
Is there a way to validate an email address and to check whether it is
sendable?


Function EmailTo(ToEmail, FromEmail, strSubject, strBody)

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = strSubject
objMessage.From = FromEmail
objMessage.To = ToEmail
objMessage.HTMLBody = strBody



objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2


objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = MAILSERVER

objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update


If objMessage.Send Then
EmailTo = 1
Else
EmailTo = 0
End If

Set objMessage = nothing
End Function



The code shown as above, even if the mail is not successfully send, it still
return the value 1.
 
E

Evertjan.

=?Utf-8?B?RGF2aWQsIHRoZSBncmVhdA==?= wrote on 17 jun 2008 in
microsoft.public.inetserver.asp.general:
Is there a way to validate an email address

While you can check if the address has a @ in it and some letters before
the @ and letters period letters after the @, you will experience that any
more elaborate scheme will usually get some of your correspondents into
unforeseen trouble.
and to check whether it is sendable?

The proof of the pudding is in the eating,
trial and error sending is the only real valid option,
I think.

[Some?] serverside email programmes,
I happily use Jmail and have no experience with others,
return a boolean false if the sending aborts.

Final testing without sending if the email adress string is valid,
seems impossible.
 
M

Mike Brind [MVP]

Evertjan. said:
=?Utf-8?B?RGF2aWQsIHRoZSBncmVhdA==?= wrote on 17 jun 2008 in
microsoft.public.inetserver.asp.general:
Is there a way to validate an email address

While you can check if the address has a @ in it and some letters before
the @ and letters period letters after the @, you will experience that any
more elaborate scheme will usually get some of your correspondents into
unforeseen trouble.
and to check whether it is sendable?

The proof of the pudding is in the eating,
trial and error sending is the only real valid option,
I think.

[Some?] serverside email programmes,
I happily use Jmail and have no experience with others,
return a boolean false if the sending aborts.

Final testing without sending if the email adress string is valid,
seems impossible.

There are 3rd party components that will validate email addresses, but I
can't vouch for how good any of them are. A trial version of an Hexillion
component helped me clean a list up once, but wasn't foolproof.
 
D

Daniel Crichton

Mike wrote on Tue, 17 Jun 2008 10:47:21 +0100:

Evertjan. said:
=?Utf-8?B?RGF2aWQsIHRoZSBncmVhdA==?= wrote on 17 jun 2008 in
microsoft.public.inetserver.asp.general:
Is there a way to validate an email address
While you can check if the address has a @ in it and some letters
before the @ and letters period letters after the @, you will
experience that any more elaborate scheme will usually get some of
your correspondents into unforeseen trouble.
and to check whether it is sendable?
The proof of the pudding is in the eating, trial and error sending is
the only real valid option,
I think.
[Some?] serverside email programmes,
I happily use Jmail and have no experience with others, return a
boolean false if the sending aborts.
Final testing without sending if the email adress string is valid,
seems impossible.
There are 3rd party components that will validate email addresses, but
I can't vouch for how good any of them are. A trial version of an
Hexillion component helped me clean a list up once, but wasn't
foolproof.

If it relies on using the VRFY command in SMTP, or goes through the motions
of sending but sending a QUIT after the SMTP response that says the RCPT TO
clause it accetped, then it'll only work in specific circumstances. VRFY is
often disabled as it's an open invitation for spammers to just repeatedly
try random strings until they find valid addresses, and the other method
only works if you happen to be sending direct to the receipient SMTP server
and it is able to verify that the account exists and doesn't have a blanket
setting to just accept all email and discard those that are for non-existent
accounts. Often the web server is unable to contact the end recipient server
directly and so these methods will fail before even getting to the first
stage.
 
M

Mike Brind [MVP]

Daniel Crichton said:
Mike wrote on Tue, 17 Jun 2008 10:47:21 +0100:

Evertjan. said:
=?Utf-8?B?RGF2aWQsIHRoZSBncmVhdA==?= wrote on 17 jun 2008 in
microsoft.public.inetserver.asp.general:
Is there a way to validate an email address
While you can check if the address has a @ in it and some letters
before the @ and letters period letters after the @, you will
experience that any more elaborate scheme will usually get some of
your correspondents into unforeseen trouble.
and to check whether it is sendable?
The proof of the pudding is in the eating, trial and error sending is
the only real valid option,
I think.
[Some?] serverside email programmes,
I happily use Jmail and have no experience with others, return a
boolean false if the sending aborts.
Final testing without sending if the email adress string is valid,
seems impossible.
There are 3rd party components that will validate email addresses, but
I can't vouch for how good any of them are. A trial version of an
Hexillion component helped me clean a list up once, but wasn't
foolproof.

If it relies on using the VRFY command in SMTP, or goes through the
motions of sending but sending a QUIT after the SMTP response that says
the RCPT TO clause it accetped, then it'll only work in specific
circumstances. VRFY is often disabled as it's an open invitation for
spammers to just repeatedly try random strings until they find valid
addresses, and the other method only works if you happen to be sending
direct to the receipient SMTP server and it is able to verify that the
account exists and doesn't have a blanket setting to just accept all email
and discard those that are for non-existent accounts. Often the web server
is unable to contact the end recipient server directly and so these
methods will fail before even getting to the first stage.

Which all goes to support Evertjan's reply - send the email. Get them to
click a link in it that validates the fact that they received it. We
shouldn't really be sending email to people unless they have asked for it in
the first place...
 
T

Tim Slattery

David said:
Hi,
Is there a way to validate an email address and to check whether it is
sendable?

Not really. You can check for proper syntax, but remember that there
are a variety of acceptable syntaxes for email addresses. Once you're
sure the syntax is right, does the domain name actually have a mail
server? And if there's a server, is the user name (left of the @ sign)
a legitimate user on that server? The only way to be 100% sure is to
send it. Of course, if the user is bogus the mail server may just
swallow the message and send no bounce message. Then you're no wiser
than you were before.
 
D

Daniel Crichton

Mike wrote on Tue, 17 Jun 2008 13:07:35 +0100:

Daniel Crichton said:
Mike wrote on Tue, 17 Jun 2008 10:47:21 +0100:
=?Utf-8?B?RGF2aWQsIHRoZSBncmVhdA==?= wrote on 17 jun 2008 in
microsoft.public.inetserver.asp.general:
Is there a way to validate an email address
While you can check if the address has a @ in it and some letters
before the @ and letters period letters after the @, you will
experience that any more elaborate scheme will usually get some of
your correspondents into unforeseen trouble.
and to check whether it is sendable?
The proof of the pudding is in the eating, trial and error sending
is the only real valid option,
I think.
[Some?] serverside email programmes,
I happily use Jmail and have no experience with others, return a
boolean false if the sending aborts.
Final testing without sending if the email adress string is valid,
seems impossible.
There are 3rd party components that will validate email addresses,
but
I can't vouch for how good any of them are. A trial version of an
Hexillion component helped me clean a list up once, but wasn't
foolproof.
If it relies on using the VRFY command in SMTP, or goes through the
motions of sending but sending a QUIT after the SMTP response that
says the RCPT TO clause it accetped, then it'll only work in
specific circumstances. VRFY is often disabled as it's an open
invitation for spammers to just repeatedly try random strings until
they find valid addresses, and the other method only works if you
happen to be sending direct to the receipient SMTP server and it is
able to verify that the account exists and doesn't have a blanket
setting to just accept all email and discard those that are for
non-existent accounts. Often the web server is unable to contact the
end recipient server directly and so these methods will fail before
even getting to the first stage.
Which all goes to support Evertjan's reply - send the email. Get them
to click a link in it that validates the fact that they received it. We
shouldn't really be sending email to people unless they have asked
for it in the first place...

I can't agree more with that reply :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top