Dart Smtp, Pop, Imap Controls
Login Method
A hostname or IP address.
Optional. Specifies the server account.
Optional. Specifies the password for the server account.
Optional. Specifies the desired port number. Defaults to the well-known port 143 (or 993 for implicitly secure connections).
Description
Connect to a server and authenticate in one step.
Syntax
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 _
) 
Parameters
Server
A hostname or IP address.
Username
Optional. Specifies the server account.
Password
Optional. Specifies the password for the server account.
RemotePort
Optional. Specifies the desired port number. Defaults to the well-known port 143 (or 993 for implicitly secure connections).
Remarks
Most IMAP servers require a Username and a Password.

Error Codes

This method may generate the following error code (refer to MailErrorConstants for a complete list of error codes):

Example
Most IMAP servers require a Username and Password, as shown in the following VB example.
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
See Also

Imap Object  | Imap Members


PowerTCP Mail for ActiveX Documentation Version 2.13
© 2018 Dart Communications. All Rights Reserved.
Send comments on this topic