Author |
|
alasdaircs Newbie
Joined: 17 February 2010 Location: United Kingdom
Online Status: Offline Posts: 3
|
Posted: 17 February 2010 at 8:02am | IP Logged
|
|
|
My Windows Service runs this on a timer:
Code:
using( _pop3Client = new Pop3() )
{
MailMessage msg = null;
do
{
OnConnect();
OnLogin();
if( ( msg = ReceiveMessage() ) != null )
{
OnMessageReceived( msg );
OnMessageDelete( msg );
}
OnDisconnect();
}
while( msg != null );
}
|
|
|
The relevent bits are here:
Code:
protected virtual void OnDisconnect()
{
CLog.Log( TraceEventType.Verbose, "Disconnecting..." );
_pop3Client.Disconnect();
CLog.Log( TraceEventType.Verbose, "Disconnected" );
}
protected virtual void OnMessageDelete( MailMessage message )
{
CLog.Log( TraceEventType.Verbose, "Deleting message 1..." );
_pop3Client.DeleteMessage( 1 );
CLog.Log( TraceEventType.Verbose, "Deleted message 1" );
}
|
|
|
The POP3 server is Exchange Server 2003, and it's on an internal fast LAN.
I've got a problem where sometimes a message isn't deleted from the server, despite me having called DeleteMessage(1) and Disconnect().
Code:
15/02/2010 19:43:28 ServiceManager Verbose: Opening POP3 Server TSP-SVR-01:110
15/02/2010 19:43:28 ServiceManager Verbose: Connecting to TSP-SVR-01...
15/02/2010 19:43:28 ServiceManager Verbose: Connected
15/02/2010 19:43:28 ServiceManager Verbose: Authenticating remortgage...
15/02/2010 19:43:28 ServiceManager Verbose: Authenticated, inbox contains 8635 bytes in 2 messages
15/02/2010 19:43:28 ServiceManager Verbose: Checking for messages...
15/02/2010 19:43:28 ServiceManager Verbose: Attempting to download a message...
15/02/2010 19:43:28 ServiceManager Information: 4931 byte message received from "Mayet, Jamil" <j.mayet@###.###> re: RE: Authority to Communicate through an Authorised Person Response Form - 017869-0328
15/02/2010 19:43:28 Workflow Information: Created new instance 594404 with parent 0 for object of type CUncodedScan guid 237c12cf-ecc2-493a-a534-4daab0ee090d
15/02/2010 19:43:29 ServiceManager Verbose: Deleting message 1...
15/02/2010 19:43:29 ServiceManager Verbose: Deleted message 1
15/02/2010 19:43:29 ServiceManager Verbose: Disconnecting...
15/02/2010 19:43:29 ServiceManager Verbose: Disconnected
15/02/2010 19:43:29 ServiceManager Verbose: Connecting to TSP-SVR-01...
15/02/2010 19:43:29 ServiceManager Verbose: Connected
15/02/2010 19:43:29 ServiceManager Verbose: Authenticating remortgage...
15/02/2010 19:43:29 ServiceManager Verbose: Authenticated, inbox contains 8635 bytes in 2 messages
15/02/2010 19:43:29 ServiceManager Verbose: Checking for messages...
15/02/2010 19:43:29 ServiceManager Verbose: Attempting to download a message...
15/02/2010 19:43:29 ServiceManager Information: 4931 byte message received from "Mayet, Jamil" <j.mayet@###.###> re: RE: Authority to Communicate through an Authorised Person Response Form - 017869-0328
15/02/2010 19:43:29 Workflow Information: Created new instance 594405 with parent 0 for object of type CUncodedScan guid 4eb0ca80-66b3-4089-ab36-ea000e40eea6
15/02/2010 19:43:30 ServiceManager Verbose: Deleting message 1...
15/02/2010 19:43:30 ServiceManager Verbose: Deleted message 1
15/02/2010 19:43:30 ServiceManager Verbose: Disconnecting...
15/02/2010 19:43:30 ServiceManager Verbose: Disconnected
|
|
|
Most of the time this works as expected. Any ideas?
BTW, I went to add logging with pop.Log, but sadly your logging isn't done through an interface so I can't provide an alternative implementation to integrate with my (Enterprise Library) logging system - but that's another story.
Best regards,
Alasdair.
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 17 February 2010 at 8:24am | IP Logged
|
|
|
Without MailBee log, it's not possible to say anything for sure. I don't understand why you have problems with writing into MailBee log. Even if you want to write into your own log, what's the problem then? Pop3.LogNewEntry event allows you to delegate writing log messages anywhere you wish.
Regards,
Alex
|
Back to Top |
|
|
alasdaircs Newbie
Joined: 17 February 2010 Location: United Kingdom
Online Status: Offline Posts: 3
|
Posted: 17 February 2010 at 5:08pm | IP Logged
|
|
|
Ah - I hadn't spotted LogNewEvent. All working with integrated logging now thanks.
I disabled pipelining in Connect() just in case that was a problem, and now it won't download a single message.
Here's a log trace:
Code:
18/02/2010 01:00:48 ServiceManager Verbose: Opening POP3 Server TSP-SVR-01:110
18/02/2010 01:00:48 ServiceManager Verbose: Connecting to TSP-SVR-01...
18/02/2010 01:00:48 ServiceManager Verbose: MailBee: [Info] Will resolve host "TSP-SVR-01".
18/02/2010 01:00:48 ServiceManager Verbose: MailBee: [Info] Host "TSP-SVR-01" resolved to IP address(es) 192.168.0.1, 10.77.77.1, 172.16.1.10.
18/02/2010 01:00:48 ServiceManager Verbose: MailBee: [Info] Will connect to host "TSP-SVR-01" on port 110.
18/02/2010 01:00:48 ServiceManager Verbose: MailBee: [Info] Socket connected to IP address 192.168.0.1 on port 110.
18/02/2010 01:00:48 ServiceManager Verbose: MailBee: [Recv] +OK Microsoft Exchange Server 2003 POP3 server version 6.5.7638.1 (tsp-svr-01.#####.###) ready.
18/02/2010 01:00:48 ServiceManager Verbose: MailBee: [Info] Connected to mail service at host "TSP-SVR-01" on port 110 and ready.
18/02/2010 01:00:48 ServiceManager Verbose: Connected
18/02/2010 01:00:48 ServiceManager Verbose: Authenticating remortgage...
18/02/2010 01:00:48 ServiceManager Verbose: MailBee: [Info] Get the list of advertized SASL authentication methods via AUTH command.
18/02/2010 01:00:48 ServiceManager Verbose: MailBee: [Send] AUTH
18/02/2010 01:00:48 ServiceManager Verbose: MailBee: [Recv] +OK
NTLM
.
18/02/2010 01:00:48 ServiceManager Verbose: MailBee: [Info] Will login as "remortgage".
18/02/2010 01:00:48 ServiceManager Verbose: MailBee: [Info] Will try SASL NTLM authentication method.
18/02/2010 01:00:48 ServiceManager Verbose: MailBee: [Send] AUTH NTLM
18/02/2010 01:00:48 ServiceManager Verbose: MailBee: [Recv] +OK
18/02/2010 01:00:48 ServiceManager Verbose: MailBee: [Send] TlRMTVNTUAABAAAAAoIAAAAAAAAAAAAAAAAAAAAAAAA=
18/02/2010 01:00:48 ServiceManager Verbose: MailBee: [Recv] + TlRMTVNTUAACAAAAAAAAADgAAAACggACGVKFOBif3tAAAAAAAAAAAAAAAAA4 AAAABQLODgAAAA8=
18/02/2010 01:00:48 ServiceManager Verbose: MailBee: [Send] TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAAAwAAAACgAKAHAAAAAA AAAAQwAAAAAAAABDAAAAAoIAAPM1xM9jKGrPz7BpFWihMbO09YXyMOE5NktO bRNZOLR2gb6DpFVz7VAyfC3vNTOItXJlbW9ydGdhZ2U=
18/02/2010 01:00:48 ServiceManager Verbose: MailBee: [Recv] +OK User successfully logged on.
18/02/2010 01:00:48 ServiceManager Verbose: MailBee: [Info] Logged in as "remortgage".
18/02/2010 01:00:48 ServiceManager Verbose: MailBee: [Info] Download inbox statistics.
18/02/2010 01:00:48 ServiceManager Verbose: MailBee: [Send] STAT
18/02/2010 01:00:48 ServiceManager Verbose: MailBee: [Recv] +OK 24 1066380
18/02/2010 01:00:48 ServiceManager Verbose: Authenticated, inbox contains 1066380 bytes in 24 messages
18/02/2010 01:00:48 ServiceManager Verbose: Checking for messages...
18/02/2010 01:00:48 ServiceManager Verbose: Attempting to download a message...
18/02/2010 01:00:48 ServiceManager Verbose: MailBee: [Info] Will download entire message (index=1).
18/02/2010 01:00:48 ServiceManager Verbose: MailBee: [Send] RETR 1
18/02/2010 01:01:09 ServiceManager Verbose: MailBee: [Info] Error: The socket object used by MailBee was unexpectedly closed. InnerException message follows: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
18/02/2010 01:01:09 ServiceManager Verbose: MailBee: [Info] Will disconnect from host "TSP-SVR-01".
18/02/2010 01:01:09 ServiceManager Verbose: MailBee: [Info] Disconnected from host "TSP-SVR-01".
|
|
|
And here's a Wireshark trace:
Code:
+OK Microsoft Exchange Server 2003 POP3 server version 6.5.7638.1 (tsp-svr-01.stokes.msi) ready.
AUTH
+OK
NTLM
.
AUTH NTLM
+OK
TlRMTVNTUAABAAAAAoIAAAAAAAAAAAAAAAAAAAAAAAA=
+ TlRMTVNTUAACAAAAAAAAADgAAAACggACxzsUCBFbaF8AAAAAAAAAAAAAAAA4 AAAABQLODgAAAA8=
TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAAAwAAAACgAKAHAAAAAA AAAAQwAAAAAAAABDAAAAAoIAAGfi5O5XbDK12Qb8M0gM4NoGxb/jrFvpp37k U1AJtn5qltnzclv8xALxW+5M9Gxdc3JlbW9ydGdhZ2U=
+OK User successfully logged on.
STAT
+OK 24 1066380
RETR 1
+OK
X-Antispam: NO; Spamcatcher 6.0.0. Score 1
<rest of message follows>
|
|
|
If I connect with telnet to port 110 and type the commands manually (but with USER and PASS) I get the message back instantly. Very puzzling. Any ideas?
|
Back to Top |
|
|
alasdaircs Newbie
Joined: 17 February 2010 Location: United Kingdom
Online Status: Offline Posts: 3
|
Posted: 18 February 2010 at 12:42am | IP Logged
|
|
|
Well, I got it going again by moving the oldest message in the mailbox to another folder. The rest all got processed fine. I then moved the offending message back into the mailbox, and it got processed too! Oi vey.
I'll let you know if the delete problem shows up again.
Cheers,
Alasdair
|
Back to Top |
|
|