Author |
|
kandola Newbie
Joined: 25 July 2007 Location: United Kingdom
Online Status: Offline Posts: 5
|
Posted: 13 August 2007 at 1:38am | IP Logged
|
|
|
Getting this when attempting to POP3:
MailBee.NET - Socket connection was aborted by remote host. - at bo.b(String A_0, dl A_1, Boolean A_2)
at bo.a(String A_0, Boolean A_1)
at a9.a(String A_0, String A_1, String A_2)
at cj.a(AuthenticationMethods A_0, AuthenticationMethods A_1, SaslMethod A_2, AuthenticationOptions A_3, String A_4, String A_5, String A_6)
at bo.a(AuthenticationMethods A_0, AuthenticationMethods A_1, SaslMethod A_2, AuthenticationOptions A_3, String A_4, String A_5, String A_6)
at bo.b()
at bl.d(Boolean A_0)
at bl.b()
at am.a0()
at a6.a(Boolean A_0, String A_1, String A_2, AuthenticationMethods A_3, AuthenticationOptions A_4, SaslMethod A_5)
at MailBee.Pop3Mail.Pop3.Login(String accountName, String password)
at CounterSoft.Gemini.Scheduler.MailboxProcessor.MailboxProcess .CheckEmails()
at CounterSoft.Gemini.Scheduler.MailboxProcessor.MailboxProcess .Process()
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Full details here:
http://community.countersoft.com/forums/thread/5258.aspx
Any ideas?
|
Back to Top |
|
|
Andrew AfterLogic Support
Joined: 28 April 2006 Location: United States
Online Status: Offline Posts: 1189
|
Posted: 13 August 2007 at 2:06am | IP Logged
|
|
|
Are you sure mail server address and port are specified correctly in your application powered by MailBee.NET Objects? If so, please make sure that the host your application is trying to connect has a POP3 service running (try to connect through MS Outlook or another e-mail client).
Also, this exception may be caused by various reasons. For instance, the connection was aborted by the mail server due to a timeout (mail server's timeout which cannot be changed from client side) or smart firewall/antivirus/antispam system (installed on the workstation your application powered by MailBee.NET Objects installed on) intercepts and suddenly closes the connection, etc. So if you have a firewall/antivirus/antispam software installed on your workstation, please try to disable it for testing purpose.
If the above doesn't help, please enable logging POP3 session into a file, reproduce the issue and provide us with the log file for examination. You can enable logging for POP3 protocol as follows (C# syntax):
Code:
Pop3 pop = new Pop3();
pop.Log.Enabled = true;
pop.Log.Filename = @"C:\log.txt";
pop.Log.Clear(); |
|
|
Please make sure the application has permission to write into the specified location.
Best regards,
Andrew
|
Back to Top |
|
|
kandola Newbie
Joined: 25 July 2007 Location: United Kingdom
Online Status: Offline Posts: 5
|
Posted: 15 August 2007 at 2:53am | IP Logged
|
|
|
Hi Andrew,
Okay, I think I've got the problem isolated. If you look at this generated log you'll see what it is:
[15:46:15.53] [INFO] Assembly version: 3.0.0.43.
[15:46:15.53] [INFO] Will resolve host "pop3.xxxxx.com".
[15:46:15.56] [INFO] Host "pop3.xxxxx.com" resolved to IP address(es) 66.66.170.118.
[15:46:15.56] [INFO] Will connect to host "pop3.xxxxx.com" on port 110.
[15:46:15.59] [INFO] Socket connected to IP address 66.66.170.118 on port 110.
[15:46:15.95] [RECV] +OK <12223.1187102748@mbx02.internetmailserver.net>\r\n
[15:46:15.95] [INFO] Connected to mail service at host "pop3.xxxxx.com" on port 110 and ready.
[15:46:15.96] [INFO] Get the list of POP3 capabilities via CAPA command.
[15:46:15.96] [SEND] CAPA\r\n
[15:46:16.15] [RECV] -ERR authorization first\r\n
[15:46:16.15] [INFO] Warning: The server does not support CAPA command. POP3 pipelining will not be available. The server responded: -ERR authorization first.
[15:46:16.17] [INFO] Get the list of advertized SASL authentication methods via AUTH command.
[15:46:16.17] [SEND] AUTH\r\n
[15:46:16.34] [RECV] -ERR authorization first\r\n
[15:46:16.34] [INFO] Warning: The server does not support AUTH command. SASL authentication will not be available. The server responded: -ERR authorization first.
[15:46:16.35] [INFO] Will login as "gemini@xxxxx.com".
[15:46:16.35] [INFO] Will try APOP authentication.
[15:46:16.35] [SEND] APOP gemini@xxxxx.com 6f92946\r\n
[15:46:16.54] [RECV] -ERR authorization failed\r\n
[15:46:16.54] [INFO] Will try regular USER/PASS authentication.
[15:46:16.54] [SEND] USER gemini@xxxxx.com\r\n
[15:46:16.57] [INFO] Error: Socket connection has been aborted by local machine. InnerException message follows: An established connection was aborted by the software in your host machine
[15:46:16.57] [INFO] Will disconnect from host "pop3.xxxxx.com".
[15:46:16.57] [INFO] Disconnected from host "pop3.xxxxx.com".
If you login like this:
pop.Login("gemini@xxxxx.com", "pass" )
...the component tries APOP authentication first. The mail server doesn't like that and simply closes the connection.
If instead I try:
pop.Login("gemini@xxxxx.com", "pass", MailBee.AuthenticationMethods.Regular)
..it works.
Question #1: in order to make POP3 login bullet-proof, what is the recommended sequence of login methods?
Question #2: Should we be placing try/catch blocks and attempting alternative login approach when an exception is thrown? Any recommendations/best practices?
|
Back to Top |
|
|
Andrew AfterLogic Support
Joined: 28 April 2006 Location: United States
Online Status: Offline Posts: 1189
|
Posted: 15 August 2007 at 4:00am | IP Logged
|
|
|
By default, MailBee.NET Objects use MailBee.AuthenticationMethods.Auto which means autodetecting the most secure of all supported by mail server authentication methods. But sometimes it fails like in your case. Your mail server supports neither CAPA nor AUTH commands, moreover, when it turns "regular" authentication, your mail server suddenly closes the connection, most probably because of maximum allowed number of failed commands/authentication attempts is reached. Your mail server has very specific configuration. MailBee.AuthenticationMethods.Auto works with majority of mail servers.
However, if you need to handle all possible cases, you should use try/catch blocks as you described. The order should be the same as in case with MailBee.AuthenticationMethods.Auto:
1. Try to connect with MailBee.AuthenticationMethods.Auto
2. Try to connect with MailBee.AuthenticationMethods.Apop
3. Try to connect with MailBee.AuthenticationMethods.Regular
But if you encounter a mail server which supports, for instance, SaslCramMD5 auth type only, but doesn't support either CAPA or AUTH commands, this won't work. The only possible workaround for such unlikely cases is exhaustive search of all possible auth methods.
Best regards,
Andrew
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 15 August 2007 at 5:47am | IP Logged
|
|
|
Another solution is using
Code:
pop.Login(user, pass, AuthenticationMethods.Auto, AuthenticationOptions.PreferSimpleMethods, null); |
|
|
You'll need to download the latest beta of MailBee.NET.dll to make it work.
AuthenticationOptions.PreferSimpleMethods changes the order in which authentication methods are tried from less secure to more secure.
Regards,
Alex
|
Back to Top |
|
|
kandola Newbie
Joined: 25 July 2007 Location: United Kingdom
Online Status: Offline Posts: 5
|
Posted: 15 August 2007 at 11:42am | IP Logged
|
|
|
Same question applies to SMTP! What is the recommended sequence of login methods?
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 15 August 2007 at 11:50am | IP Logged
|
|
|
You can use the same approach (AuthenticationOptions.PreferSimpleMethods option) with SMTP:
Code:
server.AuthOptions = AuthenticationOptions.PreferSimpleMethods; |
|
|
assuming server is SmtpServer instance.
Regards,
Alex
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 15 August 2007 at 11:58am | IP Logged
|
|
|
You can also set server.IgnoreLoginFailure=true to tell MailBee to still try to send the message even if the authentication failed at all. This can help if you got a server with SMTP authentication disabled (some servers still relay without authentication, usually, for certain IP addresses only).
Or, as an option for very old servers, you can try POP-before-SMTP authentication (refer to SmtpServer.AuthPopBeforeSmtp property).
Regards,
Alex
|
Back to Top |
|
|