Connect Method


Connects to the POP3 server and logs in the specified user account.

Make sure to set the following properties before calling this method:

If you want to use secure authentication and/or non-standard POP3 port, also set AuthMethod and/or PortNumber properties before calling Connect method.

If you're using Integrated Windows Authentication (IWA), you may leave UserName and Password blank but must set AuthMethod property to use IWA-compatible authentication method.

It's not required to call this method in order to connect to POP3 server (though it's recommended). Methods of POP3 object (such as RetrieveMessages, RetrieveHeaders, DeleteMessage, Ping, etc.) automatically call it if the connection is not established.

Note: You may quickly set values of ServerName, PortNumber, UserName, Password, UserDomain, TargetName properties by specifying them as parameters of Connect method.


blnResult = ObjectName.Connect([ServerName], [PortNumber], [UserName], [Password], [UserDomain], [TargetName])  
Parameters:  
ServerName As String (optional) If specified, will set POP3.ServerName property with new value  
PortNumber As Long (optional) If specified, will set POP3.PortNumber property with new value  
UserName As String (optional) If specified, will set POP3.UserName property with new value  
Password As String (optional) If specified, will set POP3.Password property with new value  
UserDomain As String (optional) The user domain name (only used with NTLM and Kerberos). If not specified, current UserDomain value will be used  
TargetName As String (optional) The SPN (only used with Kerberos). If not specified, current TargetName value will be used  
Return value As Boolean True if successful, False if connect procedure failed (mail server is not responding, username and/or password is incorrect, authentication method is not supported, license key is invalid). You can check ErrDesc property or log file to get more detailed error information  

Usage example:

Dim Mailer
'Using visual basic to create object
Set Mailer = CreateObject("MailBee.POP3")
'Using ASP to create object
'Set Mailer = Server.CreateObject("MailBee.POP3")
'In ASP use Response.Write instead of MsgBox
Mailer.LicenseKey = "put your license key here"
' Connect using default (110) PortNumber
If Mailer.Connect("mailserver.com", ,"MyName", "MyPassword") Then
  MsgBox "Connected successfully"
  Mailer.Disconnect
Else
  MsgBox Mailer.ErrDesc
End If

See Also:

ServerName Property
PortNumber Property
UserName Property
Password Property
AuthMethod Property
Disconnect Method


Copyright © 2002-2022, AfterLogic Corporation. All rights reserved.