PDA

Click to See Complete Forum and Search --> : PING a mail server?


compuGEEK
Jan 5th, 2000, 12:18 AM
Question:

I have an app that validates an email address. If you enter me@aol.com, it should validate whether or not the address is in proper format. That's fine and dandy.

However, what if I wanted to make sure the domain is not a bogus one? Is it possible to ping the mail server itself?

Thanks

------------------
CompuGEEK

Aaron Young
Jan 5th, 2000, 12:34 AM
You can attempt to connect to the Mail Server using the Winsock Control, if it's Successful, you've verified the Domain, otherwise, you can't be sure it's valid, ie.

Private Sub Command1_Click()
Winsock1.Connect "mail." & Mid$(Text1, InStr(Text1, "@") + 1), 25
End Sub

Private Sub Winsock1_Connect()
MsgBox "Email Domain Verified"
Winsock1.Close
Winsock1.RemotePort = 0
Winsock1.LocalPort = 0
End Sub

Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
If InStr(LCase(Description), "host not found") Then
MsgBox "Unable to Validate Email Domain"
End If
Winsock1.Close
Winsock1.RemotePort = 0
Winsock1.LocalPort = 0
End Sub


------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
ajyoung@pressenter.com

compuGEEK
Jan 5th, 2000, 03:58 AM
Aaron,

Thank you very much! I appreciate all your help.



------------------
CompuGEEK