Testing a mail server

daviddoria

Newcomer
Joined
Dec 24, 2008
Messages
9
I often get calls from a friend of mine's company saying "ahhh our email is not working!". I thought I could write a program that would test a few things that they could run and have easy answers to my questions when they call. Things like "Is your internet connection alive?", "can you send mail but not receive it?", etc.

Testing the outgoing mail seems easy:

Code:
        Try
            Dim EmailFrom As String = "test@from.com"
            Dim EmailTo As String = "test@to.com"
            Dim EmailSubject As String = "Test"

            'compile report
            Dim EmailBody As String = "test"

            Dim email As New Net.Mail.MailMessage(EmailFrom, EmailTo, EmailSubject, EmailBody)

            Dim emailClient As New Net.Mail.SmtpClient("smtp.server.com", 587)
            emailClient.EnableSsl = True
            emailClient.Credentials = New Net.NetworkCredential("test@from.com", "passwd")

            emailClient.Send(email)


        Catch ex As Exception
            MessageBox.Show("uh oh, error!")
            End
        End Try

        MsgBox("Email sent.")

But how would I test their incoming pop mail server? Is there a way to analyze the results of a telnet?

This command:
Code:
telnet mail.server.com 110

returns
Code:
OK POP3 READY

when the server is alive.

Or is there a way to actually receive the test email that was just sent?

Any thoughts on this? Also, any other comments on things that could be tested for network/mail "up" analysis are welcome!

Thanks,

Dave
 
I think I have an old but very basic pop3 class hanging around somewhere - will post that if I can find it.

It isn't the most functional but should be enough to do what you need to do.
 
Back
Top