User Authentication and SSL Connection


To logon POP3 or IMAP4 server, the user authentication is the first step. EAGetMail ActiveX Object supports most authentication mechanisms including: LOGIN, CRAM-MD5 and AUTH NTLM. The authentication mechanism must be specified by the following constants:

Const MailServerAuthLogin = 0
Const MailServerAuthCRAM5 = 1
Const MailServerAuthNTLM = 2		
		

The MailServerAuthCRAM5 and MailServerAuthNTLM are "Secure Password Authentication", the password is encrypted by challenge code returned by server before the password is sent to the server. In contrary, the password is sent to server in plain format with MailServerAuthLogin. Therefore, using MailServerAuthCRAM5 and MailServerAuthNTLM is more secure than using MailServerAuthLogin. However, not every mail server supports MailServerAuthCRAM5 and MailServerAuthNTLM. Especially MailServerAuthNTLM, only Microsoft Exchange Server or Windows POP3 Service supports it. Based on POP3/IMAP4 rfc, MailServerAuthLogin is supported by every POP3/IMAP4 server, so if you can't detect what authentication mechanisms that the server supports, please use MailServerAuthLogin.

Example

[VBScript]
Const MailServerAuthLogin = 0
Const MailServerAuthCRAM5 = 1
Const MailServerAuthNTLM = 2

Const MailServerPop3 = 0
Const MailServerImap4 = 1

Dim oServer
Set oServer = CreateObject("EAGetMailObj.MailServer")
oServer.Server = "myserveraddress"
oServer.User = "myuser"
oServer.Password = "mypassword"
oServer.SSLConnection = False
oServer.Protocol = MailServerPop3
oServer.AuthType = MailServerAuthLogin

SSL connection encrypts data between the POP3 & IMAP4 component and mail server to protects user, password and email content in TCP/IP level. Now this technology is commonly used and many email servers are deployed with SSL such as gmail. The mail server usually deploys SSL on another port( POP3 on 995 or other port, IMAP4 on 993 or other port ), you may query it from your server administrator) directly.

Example

[Visual Basic 6]
Const MailServerAuthLogin = 0
Const MailServerAuthCRAM5 = 1
Const MailServerAuthNTLM = 2

Const MailServerPop3 = 0
Const MailServerImap4 = 1

'connect pop3 server by normal TCP/IP without SSL connection
Dim oServer As New EAGetMailObjLib.MailServer
oServer.Server = "myserveraddress"
oServer.User = "myuser"
oServer.Password = "mypassword"
oServer.SSLConnection = False
oServer.Protocol = MailServerPop3
oServer.AuthType = MailServerAuthLogin
 
'connect imap4 server by normal TCP/IP without SSL connection    
Dim oServer As New EAGetMailObjLib.MailServer
oServer.Server = "myserveraddress"
oServer.User = "myuser"
oServer.Password = "mypassword"
oServer.SSLConnection = False
oServer.Protocol = MailServerImap4
oServer.AuthType = MailServerAuthLogin
oServer.Port = 143
    
'connect pop3 server by SSL connection on default port(995)
Dim oServer As New EAGetMailObjLib.MailServer
oServer.Server = "myserveraddress"
oServer.User = "myuser"
oServer.Password = "mypassword"
oServer.SSLConnection = True
oServer.Protocol = MailServerPop3
oServer.AuthType = MailServerAuthLogin
oServer.Port = 995
   
'connect imap4 server by SSL connection on default port(993) 
Dim oServer As New EAGetMailObjLib.MailServer
oServer.Server = "myserveraddress"
oServer.User = "myuser"
oServer.Password = "mypassword"
oServer.SSLConnection = True
oServer.Protocol = MailServerImap4
oServer.AuthType = MailServerAuthLogin
oServer.Port = 993

'connect pop3 server by SSL connection on anther port(777)
Dim oServer As New EAGetMailObjLib.MailServer
oServer.Server = "myserveraddress"
oServer.User = "myuser"
oServer.Password = "mypassword"
oServer.SSLConnection = True
oServer.Protocol = MailServerPop3
oServer.AuthType = MailServerAuthLogin
oServer.Port = 777

'connect imap4 server by SSL connection on anther port(778)
Dim oServer As New EAGetMailObjLib.MailServer
oServer.Server = "myserveraddress"
oServer.User = "myuser"
oServer.Password = "mypassword"
oServer.SSLConnection = True
oServer.Protocol = MailServerImap4
oServer.AuthType = MailServerAuthLogin
oServer.Port = 778
 

See Also

Using EAGetMail POP3 & IMAP4 ActiveX Object
Digital Signature and E-mail Encryption/Decryption
Unique Identifier (UIDL) in POP3 and IMAP4 protocol
Parse Bounced Email (delivery-report)
Work with winmail.dat (TNEF Parser)
EAGetMail ActiveX Object References
EAGetMail POP3 & IMAP4 Component Samples