Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
pgscannell  
#1 Posted : Monday, April 13, 2020 7:27:10 AM(UTC)
pgscannell

Rank: Newbie

Groups: Registered
Joined: 4/13/2020(UTC)
Posts: 0
United States
Location: Rhode Island

Here is my function:

Public Function Verify_EmailAddress ( strEmailAddress As String ) As String
Dim strReturn As String = ""

Try
Dim oMail As New EASendMail.SmtpMail ( "TryIt" )
Dim oServer As New EASendMail.SmtpServer ("" ) ' Do not set SMTP server address
Dim oSmtp As New EASendMail.SmtpClient ()

oSmtp.LogFileName = "C:\smtp.txt"
Dim mFrom As EASendMail.MailAddress = New EASendMail.MailAddress ( "PaulGScannell@gmail.com", "Jerry" )
'Dim mTo As EASendMail.MailAddressCollection = New EASendMail.MailAddressCollection ( strEmailAddress, "TestValidation" )

oMail.From = mFrom
oMail.To = strEmailAddress

oSmtp.TestRecipients(oServer, oMail)

Catch ep As Exception
strReturn = ep.Message
End Try

Return strReturn
End Function
ivan  
#2 Posted : Monday, April 13, 2020 5:51:52 PM(UTC)
ivan

Rank: Administration

Groups: Administrators
Joined: 11/11/2010(UTC)
Posts: 1,148

Thanks: 9 times
Was thanked: 54 time(s) in 54 post(s)


How does it work?

Firstly, SmtpClient performs a DNS MX record query. If it retrieves the recipient's local SMTP server successfully, SmtpClient will try to connect to this server. SmtpClient then performs "RCPT TO" command to test if this SMTP server accepts this email address.

Why we don't recommend testing email address?

Because it totally depends on your networking connection, if your networking connection to the recipient server is bad or your IP address is blocked by the recipient server, test will be failed, but it doesn't mean this email address is invalid.

Moreover, to prevent email address testing, many email providers accept the recipient address at first no matter if the address is valid or invalid, only after you sent the email data to the server, then the server rejects it if the recipient address is invalid.

Recommended Solution

Send the email to the recipient without testing. If you don't get Transport Error and Failure Report in 24 hours, that means the recipient is valid. If you get Failure Report, you should consider to remove this recipient from your mail listing.

Please do not use SmtpServer("") to send email, because if you don't have a static IP address and set correct SPF record, almost email providers would reject your message due to anti-spam policy.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.072 seconds.

EXPLORE TUTORIALS

© All Rights Reserved, AIFEI Software Limited & AdminSystem Software Limited.