Private Sub cmdSubmit_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSubmit.ServerClick 'normally validate username and password. Validation left out for code simplification Dim pop As New POP3(txtServer.Value, txtUsername.Value, txtPassword.Value) Try 'connect to the server pop.Connect() Catch ex As Exception 'record an exceptions and exit Message1.Text = "<font color=red>The following exception occurred: <br>" + ex.Message + "</font>" Return End Try Dim count As Integer = pop.MessageCount() Dim msg As String = String.Empty If count > 1 Then 'get the first message msg = "<strong>Message 1</strong><br><br>" msg += "<pre>" + Server.HtmlEncode(pop.GetMessageAsText(1)) + "</pre>" Else 'if the first message doesn't exist, write out a friendly message msg = "No messages at the server" End If 'disconnect pop.Disconnect() 'show the message Message1.Text = msg End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)