ImapException when purging

0
Hi,
 
when I call Imap.Purge method, I get the error:
 
 
ComponentPro.Net.Mail.ImapException: Internal error occurred. Refer to server log for more information. [2015-06-05 04:22:03] (NO).
 
at ComponentPro.Net.Mail.Imap.c_W5D(String c_LG, ImapResponse c_NG, Boolean c_MAE)
 
at ComponentPro.Net.Mail.Imap.c_M6D(String c_LG, Object[] c_WZ)
 
at ComponentPro.Net.Mail.Imap.c_DFE(ImapMessageSet c_HCE)
 
at MyApplication.Imap.Purge()
 
 
Don't know which server refers the ImapException: mail server (Rackspace), production server (WIndows Server 2012 R2)...
 
where can I find this server log [2015-06-05 04:22:03]?
 
I need it to know the real reason of this recurrent error.
 
 
Thanks a lot,
 
Best regards.
edited 11/16/2017 12:41:37 AM
asked 6/9/2015 8:03:44 AM
add a comment

11 Answers

0

Hi,

calling Disconnect after MoveMessage doesn't work either (anyway it would not have been a valid solution to be doing Connect, Disconnect, Connect, Disconnect.. a lot of times).

Please could you made working your code in Outlook and reply me how to achieve it?

We need with urgent a fix for this.

Best regards.

 
answered 11/16/2017 12:41:37 AM
add a comment
0

This code doesn't work for me.

The line 

IsTrue(sys.ListMessages().Count == 0);

is false, I get 1 message from NewFolder folder.

I use rackspace mail server.

 
answered 11/16/2017 12:41:37 AM
add a comment
0

We have tested that code on our imap server, Gmail server and some other ones. Have you tried calling Disconnect() after the MoveMessage call? And then you  reconnect and continue your work?

 
answered 11/16/2017 12:41:37 AM
add a comment
0

Could you tell me anything about this issue please?

It's very important for us.

 

Thanks a lot, 

Best regards.

 

 
answered 11/16/2017 12:41:37 AM
add a comment
0

Just to comment that I have run your test against Outlook and it doesn't work neither.

Could you give any workaround please?

Thanks a lot,

Best regards.

 

 

 
answered 11/16/2017 12:41:37 AM
add a comment
0

You should only call the Purge method after you have deleted messages using the DeleteMessages method. The MoveMessages internally makes use of SelectFolder and you should not call Purge after calling that method.

 
answered 11/16/2017 12:41:37 AM
add a comment
0

You should call Select() to select the original folder after calling MoveMessage. PLease see the following test code:

[code lang='c#']Imap sys = new Imap();
sys.Connect("imap.gmail.com", 993, SecurityMode.Implicit);
sys.Authenticate("myemail@gmail.com", "password");
if (!sys.FolderExists("NewFolder"))
    sys.CreateFolder("NewFolder");
else
{
    sys.Select("NewFolder");
    sys.DeleteMessage(sys.ListMessages().ToUniqueIdMessageSet());
}
if (!sys.FolderExists("NewFolder2"))
    sys.CreateFolder("NewFolder2");
else
{
    sys.Select("NewFolder2");
    sys.DeleteMessage(sys.ListMessages().ToUniqueIdMessageSet());
}
string uniqueId = sys.UploadMessage("NewFolder", GetDataFile("spam.eml"));
ImapMessageSet set = new ImapMessageSet(uniqueId);
sys.Select("NewFolder");
sys.MoveMessage(set, "NewFolder2");
sys.Select("NewFolder");
IsTrue(sys.ListMessages().Count == 0);
sys.Select("NewFolder2");
IsTrue(sys.ListMessages().Count == 1);
sys.DeleteMessage(sys.ListMessages().ToUniqueIdMessageSet());
sys.Disconnect();[/code]

 
answered 11/16/2017 12:41:37 AM
add a comment
0

Hi support,

I want to share with you some findings (hopefully it will help you).

The error use to ocurr when I do the following:

1-. Imap.MoveMessage();

2-. Imap.Purge();

 

The documentation for Purge method says:

Overloaded. Permanently removes all the messages marked as deleted from the currently selected mail.

As you can see, it's supposes that I should call Purge only if I executed before Imap.DeleteMessage but this is not the truth, I was mandatory to call Purge after MoveMessage (otherwise the messages are always remained in the original mailbox folder).

Could this be the reason?

 

 

Best regards.

 

 

 

 

 
answered 11/16/2017 12:41:37 AM
add a comment
0

Please see this topic Add logging and send us the log file.

edited 12/6/2017 1:02:18 PM
answered 11/16/2017 12:41:37 AM
add a comment
0

Hi Support,

this is the log file:

Imap: 1 [06/09/2015 17:26:00.68] Verbose - Info: State changed from 'Disconnected' to 'Connecting'.
Imap: 1 [06/09/2015 17:26:00.68] Information - Info: Connecting to secure.emailsrvr.com:993 through proxy NONE [UltimateMail v6.2.40.50606 (Production Version)].
Imap: 1 [06/09/2015 17:26:00.90] Verbose - Info: Connection established.
 [06/09/2015 17:26:01.20] Verbose - Info: Verifying server certificate ('CN=secure.emailsrvr.com, OU=EssentialSSL, OU=Domain Control Validated').
 [06/09/2015 17:26:01.29] Verbose - Info: Certificate verification result: Accept
Imap: 1 [06/09/2015 17:26:01.54] Verbose - Info: Connection secured.
Imap: 1 [06/09/2015 17:26:01.55] Verbose - Info: State changed from 'Connecting' to 'Reading'.
Imap: 1 [06/09/2015 17:26:01.59] Information - Response: * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN AUTH=TOKEN] Server ready director17.mail.iad3a.rsapps.net
Imap: 1 [06/09/2015 17:26:01.63] Verbose - Info: State changed from 'Reading' to 'Ready'.
Imap: 1 [06/09/2015 17:26:01.71] Verbose - Info: State changed from 'Ready' to 'Sending'.
Imap: 1 [06/09/2015 17:26:01.71] Information - Command: R00001 AUTHENTICATE PLAIN
Imap: 1 [06/09/2015 17:26:01.71] Verbose - Info: State changed from 'Sending' to 'Reading'.
Imap: 1 [06/09/2015 17:26:01.85] Information - Response: + 
Imap: 1 [06/09/2015 17:26:01.85] Verbose - Info: State changed from 'Reading' to 'Sending'.
Imap: 1 [06/09/2015 17:26:01.85] Information - Command: ************************************************************
Imap: 1 [06/09/2015 17:26:01.85] Verbose - Info: State changed from 'Sending' to 'Reading'.
Imap: 1 [06/09/2015 17:26:02.34] Information - Response: R00001 OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS SPECIAL-USE BINARY MOVE QUOTA] Logged in
Imap: 1 [06/09/2015 17:26:02.34] Verbose - Info: State changed from 'Reading' to 'Ready'.
Imap: 1 [06/09/2015 17:26:02.38] Verbose - Info: State changed from 'Ready' to 'Sending'.
Imap: 1 [06/09/2015 17:26:02.38] Information - Command: R00002 STATUS INBOX (UNSEEN)
Imap: 1 [06/09/2015 17:26:02.38] Verbose - Info: State changed from 'Sending' to 'Reading'.
Imap: 1 [06/09/2015 17:26:02.51] Information - Response: * STATUS INBOX (UNSEEN 0)
Imap: 1 [06/09/2015 17:26:02.51] Information - Response: R00002 OK Status completed.
Imap: 1 [06/09/2015 17:26:02.51] Verbose - Info: State changed from 'Reading' to 'Ready'.
Imap: 1 [06/09/2015 17:26:02.52] Verbose - Info: State changed from 'Ready' to 'Sending'.
Imap: 1 [06/09/2015 17:26:02.52] Information - Command: R00003 SELECT INBOX
Imap: 1 [06/09/2015 17:26:02.52] Verbose - Info: State changed from 'Sending' to 'Reading'.
Imap: 1 [06/09/2015 17:26:02.66] Information - Response: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft $Forwarded)
Imap: 1 [06/09/2015 17:26:02.66] Information - Response: * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft $Forwarded \*)] Flags permitted.
Imap: 1 [06/09/2015 17:26:02.66] Information - Response: * 0 EXISTS
Imap: 1 [06/09/2015 17:26:02.66] Information - Response: * 0 RECENT
Imap: 1 [06/09/2015 17:26:02.66] Information - Response: * OK [UIDVALIDITY 1302789606] UIDs valid
Imap: 1 [06/09/2015 17:26:02.66] Information - Response: * OK [UIDNEXT 1078450] Predicted next UID
Imap: 1 [06/09/2015 17:26:02.66] Information - Response: * OK [HIGHESTMODSEQ 2512145] Highest
Imap: 1 [06/09/2015 17:26:02.66] Information - Response: R00003 OK [READ-WRITE] Select completed (0.000 secs).
Imap: 1 [06/09/2015 17:26:02.66] Verbose - Info: State changed from 'Reading' to 'Ready'.
Imap: 1 [06/09/2015 17:26:02.74] Verbose - Info: State changed from 'Ready' to 'Sending'.
Imap: 1 [06/09/2015 17:26:02.74] Information - Command: R00004 NOOP
Imap: 1 [06/09/2015 17:26:02.74] Verbose - Info: State changed from 'Sending' to 'Reading'.
Imap: 1 [06/09/2015 17:26:02.88] Information - Response: * 1 EXISTS
Imap: 1 [06/09/2015 17:26:02.88] Information - Response: * 1 RECENT
Imap: 1 [06/09/2015 17:26:02.88] Information - Response: R00004 OK NOOP completed.
Imap: 1 [06/09/2015 17:26:02.88] Verbose - Info: State changed from 'Reading' to 'Ready'.
Imap: 1 [06/09/2015 17:26:02.91] Verbose - Info: State changed from 'Ready' to 'Sending'.
Imap: 1 [06/09/2015 17:26:02.91] Information - Command: R00005 FETCH 1:* (UID RFC822.SIZE FLAGS INTERNALDATE ENVELOPE)
Imap: 1 [06/09/2015 17:26:02.91] Verbose - Info: State changed from 'Sending' to 'Reading'.
Imap: 1 [06/09/2015 17:26:03.05] Information - Response: * 1 FETCH (UID 1078450 RFC822.SIZE 1963191 FLAGS (\Recent) INTERNALDATE "09-Jun-2015 11:26:02 -0400" ENVELOPE ("Tue, 09 Jun 2015 17:25:49 +0200" NIL (("Juan Ortega" NIL "juan.ortega" "youroffice.se")) (("Juan Ortega" NIL "juan.ortega" "youroffice.se")) (("Juan Ortega" NIL "juan.ortega" "youroffice.se")) (("juan.ortega@ibistic.com" NIL "juan" "ibistic.com")) NIL NIL NIL "<a0d07833349741b08c482afce3749b31@24SevenOffice.com>"))
Imap: 1 [06/09/2015 17:26:03.05] Information - Response: R00005 OK Fetch completed.
Imap: 1 [06/09/2015 17:26:03.05] Verbose - Info: State changed from 'Reading' to 'Ready'.
Imap: 1 [06/09/2015 17:26:03.52] Verbose - Info: State changed from 'Ready' to 'Sending'.
Imap: 1 [06/09/2015 17:26:03.52] Information - Command: R00006 UID COPY 1078450 InProgress
Imap: 1 [06/09/2015 17:26:03.52] Verbose - Info: State changed from 'Sending' to 'Reading'.
Imap: 1 [06/09/2015 17:26:03.71] Information - Response: R00006 OK [COPYUID 1302789612 1078450 976017] Copy completed.
Imap: 1 [06/09/2015 17:26:03.73] Verbose - Info: State changed from 'Reading' to 'Ready'.
Imap: 1 [06/09/2015 17:26:03.79] Verbose - Info: State changed from 'Ready' to 'Sending'.
Imap: 1 [06/09/2015 17:26:03.79] Information - Command: R00007 UID STORE 1078450 +FLAGS (\Deleted)
Imap: 1 [06/09/2015 17:26:03.79] Verbose - Info: State changed from 'Sending' to 'Reading'.
Imap: 1 [06/09/2015 17:26:04.13] Information - Response: * 1 FETCH (UID 1078450 FLAGS (\Deleted \Recent))
Imap: 1 [06/09/2015 17:26:04.13] Information - Response: R00007 OK Store completed.
Imap: 1 [06/09/2015 17:26:04.13] Verbose - Info: State changed from 'Reading' to 'Ready'.
Imap: 1 [06/09/2015 17:26:04.23] Verbose - Info: State changed from 'Ready' to 'Sending'.
Imap: 1 [06/09/2015 17:26:04.23] Information - Command: R00008 EXPUNGE
Imap: 1 [06/09/2015 17:26:04.23] Verbose - Info: State changed from 'Sending' to 'Reading'.
Imap: 1 [06/09/2015 17:26:04.74] Information - Response: R00008 NO [SERVERBUG] Internal error occurred. Refer to server log for more information. [2015-06-09 11:26:04]
Imap: 1 [06/09/2015 17:26:04.74] Verbose - Info: State changed from 'Reading' to 'Ready'.
Imap: 1 [06/09/2015 17:26:04.76] Error - Info: ComponentPro.Net.Mail.ImapException: Internal error occurred. Refer to server log for more information. [2015-06-09 11:26:04] (NO).
   at ComponentPro.Net.Mail.Imap.c_W5D(String c_LG, ImapResponse c_NG, Boolean c_MAE)
   at ComponentPro.Net.Mail.Imap.c_M6D(String c_LG, Object[] c_WZ)
   at ComponentPro.Net.Mail.Imap.c_DFE(ImapMessageSet c_HCE)
Imap: 1 [06/09/2015 17:26:04.79] Verbose - Info: State changed from 'Ready' to 'Sending'.
Imap: 1 [06/09/2015 17:26:04.79] Information - Command: R00009 EXPUNGE
Imap: 1 [06/09/2015 17:26:04.79] Verbose - Info: State changed from 'Sending' to 'Reading'.
Imap: 1 [06/09/2015 17:26:04.93] Information - Response: R00009 NO [SERVERBUG] Internal error occurred. Refer to server log for more information. [2015-06-09 11:26:04]
Imap: 1 [06/09/2015 17:26:04.93] Verbose - Info: State changed from 'Reading' to 'Ready'.
Imap: 1 [06/09/2015 17:26:04.93] Error - Info: ComponentPro.Net.Mail.ImapException: Internal error occurred. Refer to server log for more information. [2015-06-09 11:26:04] (NO).
   at ComponentPro.Net.Mail.Imap.c_W5D(String c_LG, ImapResponse c_NG, Boolean c_MAE)
   at ComponentPro.Net.Mail.Imap.c_M6D(String c_LG, Object[] c_WZ)
   at ComponentPro.Net.Mail.Imap.c_DFE(ImapMessageSet c_HCE)
 
Thanks a lot,
 
Best regards.

 

 
answered 11/16/2017 12:41:37 AM
add a comment
0

If I don't call Purge, the message is moved but it also remains in the original folder with status Delete  (works like a copy/paste) so if I query again the original foder the previously moved mail is returned again.

How can I permanently move a message without calling after Purge?

 
answered 11/16/2017 12:41:37 AM
add a comment

Your Answer

Not the answer you're looking for? Browse other questions tagged imap or ask your own question.