Search The ForumSearch   RegisterRegister  LoginLogin

MailBee IMAP4

 AfterLogic Forum : MailBee IMAP4
Subject Topic: Move Messge Error Post ReplyPost New Topic
Message << Prev Topic | Next Topic >>

Joined: 13 April 2008
Location: United Kingdom
Online Status: Offline
Posts: 1
Posted: 13 April 2008 at 6:42am | IP Logged Quote garemegets


Having a problem with MoveMessage.. Everyting works fine excpe the move

I Get Error : Error: The server has responded with negative reply. The server responded: MBN00000004 NO Error in IMAP command received by server..

Please help!
(Logfile is after code)
Code :
class email
        private Imap _mail;
        private string _sMailServer;
        private string _sInBox;
        public email()
             Imap.LicenseKey = ConfigurationManager.AppSettings["IMAP Licence"];
             _mail = new Imap();
             // Get the mail server Settings
             _sMailServer = ConfigurationManager.AppSettings["MailServer"];
             // Get the Email Folder
             _sInBox = ConfigurationManager.AppSettings["InBox"];

        public bool Login()
             if (!_mail.IsLoggedIn)

                      if (!_mail.Connect(_sMailServer))
                          EventLogger.LogError("MailService", "Cound not connect to Mail Server : " + _sMailServer);
                     return true;

                catch (MailBee.MailBeeConnectionException E)
                     EventLogger.LogError("MailService", E.ToString());
                     return false;
                return true;

        public void processAccount(EmailAccountClass Account)
             // Log Onto Server
             if (Login())
                // Login to account

                      _mail.Login(Account.UserName, Account.Password);
                      // Select The Folder
                      // check to see if there are any messages
                      if (_mail.MessageCount > 0)
                          // Download the message
                          MailMessage msg = _mail.DownloadEntireMessage(1, false); // just get the first one
                          // Extract the Reference out of the Email
                          string RequestID = msg.Subject;
                          int posBegin = RequestID.LastIndexOf("[");
                          int posEnd = RequestID.LastIndexOf("]");

                          if (posBegin > 0 && posEnd > 0)
                               RequestID = RequestID.Substring(posBegin + 1, posEnd - posBegin - 1);
                               int iRequestID = Convert.ToInt32(RequestID);
                               // Get the Request ID from the Database

                               ReportsRequest request = new ReportsRequest();

                               ReportRequestItem item = request.RequestItemGetbyRequestID(iRequestID);
                               item.RequestStatus = RequestStatusEnum.ResponceRecieved;
                               if (msg.HasAttachments)
                                   // Have the Attachment to Disk
                                   msg.Attachments.SaveAll(item.ReportPath, true);
                                   item.RequestStatus = RequestStatusEnum.ReportComplete;
                                   // delet the mail message from the server
                                  // _mail.DeleteMessages(msg.UidOnServer.ToString(),true);
                                   UidPlusResult res = new UidPlusResult();
                                   _mail.MoveMessages(msg.UidOnServer.ToString(), true, "Trash",res);
                               EventLogger.LogWarning("MailService", "Tried to process an eMail that did not conform to Groundsure Spec : Subject :- " + msg.Subject);

                catch (Exception E)
                     EventLogger.LogError("MailService", "Failed to process account : " + Account.UserName + "\n" + E.ToString());


Log File :

[08:20:54.64] [INFO] Assembly version:
[08:20:54.64] [INFO] Will login as "".
[08:20:54.66] [INFO] Will try regular LOGIN authentication.
[08:20:54.67] [SEND] MBN00000001 LOGIN "" "********"\r\n
[08:20:54.69] [RECV] MBN00000001 OK LOGIN Ok.\r\n [Total 26 bytes received.]
[08:20:54.69] [INFO] Logged in as "".
[08:20:54.69] [INFO] Select folder "Inbox".
[08:20:54.69] [SEND] MBN00000002 SELECT "Inbox"\r\n
[08:20:54.72] [RECV] * FLAGS (\Draft \Answered \Flagged \Deleted \Seen \Recent)\r\n [Total 60 bytes received.]
[08:20:54.72] [RECV] * OK [PERMANENTFLAGS (\* \Draft \Answered \Flagged \Deleted \Seen)] Limited\r\n [Total 77 bytes received.]
[08:20:54.72] [RECV] * 1 EXISTS\r\n [Total 12 bytes received.]
[08:20:54.72] [RECV] * 0 RECENT\r\n [Total 12 bytes received.]
[08:20:54.72] [RECV] * OK [UIDVALIDITY 1207822249] Ok\r\n [Total 34 bytes received.]
[08:20:54.72] [RECV] * OK [MYRIGHTS "acdilrsw"] ACL\r\n [Total 32 bytes received.]
[08:20:54.72] [RECV] MBN00000002 OK [READ-WRITE] Ok\r\n [Total 32 bytes received.]
[08:20:54.73] [INFO] Will download envelopes.
[08:20:54.73] [SEND] MBN00000003 FETCH 1 (UID RFC822.SIZE BODY[])\r\n
[08:20:58.88] [RECV] * 1 FETCH (UID 9 RFC822.SIZE 995570 BODY[] {995570}\r\n
[08:20:58.88] [RECV] [Literal of length 995570.]
[08:20:58.88] [RECV] )\r\n [Total 995626 bytes received.]
[08:20:58.91] [RECV] MBN00000003 OK FETCH completed.\r\n [Total 33 bytes received.]
[08:20:58.91] [INFO] Envelopes downloaded
[08:21:17.21] [INFO] Will move messages to folder "Trash".
[08:21:17.22] [INFO] Will copy messages to folder "Trash".
[08:21:17.22] [SEND] MBN00000004 UID COPY 9 "Trash"\r\n
[08:21:17.24] [RECV] MBN00000004 NO Error in IMAP command received by server.\r\n [Total 58 bytes received.]
[08:21:17.25] [INFO] Error: The server has responded with negative reply. The server responded: MBN00000004 NO Error in IMAP command received by server..
[08:21:23.16] [SEND] MBN00000005 LOGOUT\r\n
[08:21:23.18] [RECV] * BYE Courier-IMAP server shutting down\r\n [Total 41 bytes received.]
[08:21:23.18] [RECV] MBN00000005 OK LOGOUT completed\r\n [Total 33 bytes received.]
[08:21:23.18] [INFO] Will disconnect from host "".
[08:21:23.18] [INFO] Disconnected from host "".
Back to Top View garemegets's Profile Search for other posts by garemegets
AfterLogic Support
AfterLogic Support

Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 14 April 2008 at 6:30am | IP Logged Quote Andrew

We've just rechecked the command which causes the issue:

MBN00000004 UID COPY 9 "Trash"\r\n

And found it fulfills the RFC 3501. Looks like an issue on IMAP server side.

Are you sure both the source and the destination folders exist on the server? Are you sure your application tries to copy existing message?

Have you tried to copy the same message between the same folders via another e-mail client like MS Outlook or Outlook Express?

Best regards,
Back to Top View Andrew's Profile Search for other posts by Andrew

Joined: 21 June 2011
Location: United States
Online Status: Offline
Posts: 1
Posted: 21 June 2011 at 12:04pm | IP Logged Quote jamesj3k

In our case, adding an inbox prefix solved the error. Try selecting the folder and see if you get an error. We had to experiment around with different formats until it was able to select the folder, then used that folder name in the move command.

For example: imap.MoveMessages(strUids, true, "INBOX.saved");
Back to Top View jamesj3k's Profile Search for other posts by jamesj3k Visit jamesj3k's Homepage

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide