User Authentication and SSL Connection


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

ServerAuthType.AuthCRAM5 and ServerAuthType.AuthNTLM 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 ServerAuthType.AuthLogin. Therefore, using ServerAuthType.AuthCRAM5 or ServerAuthType.AuthNTLM is more secure than using ServerAuthType.AuthLogin. However, not every mail server supports ServerAuthType.AuthCRAM5 or ServerAuthType.AuthNTLM. Especially ServerAuthType.AuthNTLM, only Microsoft Exchange Server or Windows POP3 Service supports it. Based on POP3/IMAP4 rfc, ServerAuthType.AuthLogin is supported by every POP3/IMAP4 server, so if you can't detect what authentication mechanisms the server supports, simply use ServerAuthType.AuthLogin.

Example

[C#]
MailServer oServer  = new MailServer("myserveraddress", 
    "myuser", "mypassword", false, 
    ServerAuthType.AuthLogin, ServerProtocol.Pop3);

SSL connection encrypts data between the POP3 & IMAP4 component and mail server to protects user, password and email content at 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

[C#]
//connect pop3 server by normal TCP/IP without SSL connection
MailServer oServer  = new MailServer("myserveraddress", 
    "myuser", "mypassword",  false, 
    ServerAuthType.AuthLogin, ServerProtocol.Pop3);
 
//connect imap4 server by normal TCP/IP without SSL connection    
MailServer oServer  = new MailServer("myserveraddress", 
    "myuser", "mypassword", false, 
    ServerAuthType.AuthLogin, ServerProtocol.Imap4 );
    
//connect pop3 server by SSL connection on default port(995)
MailServer oServer  = new MailServer("myserveraddress", 
    "myuser", "mypassword", true, 
    ServerAuthType.AuthLogin, ServerProtocol.Pop3);
   
//connect imap4 server by SSL connection on default port(993) 
MailServer oServer  = new MailServer("myserveraddress", 
    "myuser", "mypassword", true, 
    ServerAuthType.AuthLogin, ServerProtocol.Imap4 );

//connect pop3 server by SSL connection on anther port(777)
MailServer oServer  = new MailServer("myserveraddress", 
    "myuser", "mypassword", true, 
    ServerAuthType.AuthLogin, ServerProtocol.Pop3);
oServer.Port = 777;

//connect imap4 server by SSL connection on anther port(778)
MailServer oServer  = new MailServer("myserveraddress", 
    "myuser", "mypassword", true, 
    ServerAuthType.AuthLogin, ServerProtocol.Pop3);
oServer.Port = 778;
 

See Also

Using EAGetMail POP3 & IMAP4 Component
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 Namespace References
EAGetMail POP3 & IMAP4 Component Samples