Imap Object : Login Method |
Visual Basic |
---|
Public Sub Login( _ ByVal Server As String, _ Optional ByVal Username As String, _ Optional ByVal Password As String, _ Optional ByVal RemotePort As Long = 0 _ ) |
This method may generate the following error code (refer to MailErrorConstants for a complete list of error codes):
Private Sub Command1_Click() On Error GoTo OnError ' use intrinsic error handling Imap1.Timeout = 30000 Imap1.Login "imap.test.com", "user", "pass" If Imap1.State = tcpConnected Then MsgBox "Logged In!" Imap1.Logout ' end server session If Imap1.State = tcpClosed Then MsgBox "Session Completed" Exit Sub OnError: ' Any error jumps here Debug.Print "Error #" + CStr(Err.Number) + ": " + Err.Description End Sub