Results 1 to 3 of 3

Thread: PING a mail server?

  1. #1

    Thread Starter
    Hyperactive Member compuGEEK's Avatar
    Join Date
    May 1999
    Location
    Mpls,MN,USA
    Posts
    281

    Post

    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


  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,176

    Post

    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.
    Code:
    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


  3. #3

    Thread Starter
    Hyperactive Member compuGEEK's Avatar
    Join Date
    May 1999
    Location
    Mpls,MN,USA
    Posts
    281

    Post

    Aaron,

    Thank you very much! I appreciate all your help.



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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width