| Author |  | 
      
        | garemegets Newbie
 
  
  
 Joined: 13 April 2008
 Location: United Kingdom
 Online Status: Offline
 Posts: 1
 | 
          Hi,
           | Posted: 13 April 2008 at 6:42am | IP Logged |   |  
           | 
 |  
 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!
 Thanks
 (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)
 {
 try
 {
 
 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;
 }
 }
 else
 return true;
 
 }
 
 public void processAccount(EmailAccountClass Account)
 {
 // Log Onto Server
 if (Login())
 {
 // Login to account
 try
 {
 
 _mail.Login(Account.UserName, Account.Password);
 // Select The Folder
 _mail.SelectFolder(_sInBox);
 // 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;
 request.CommitChanges();
 request.Close();
 if (msg.HasAttachments)
 {
 // Have the Attachment to Disk
 msg.Attachments.SaveAll(item.ReportPath, true);
 item.RequestStatus = RequestStatusEnum.ReportComplete;
 request.CommitChanges();
 // 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);
 }
 }
 else
 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());
 }
 _mail.Disconnect();
 }
 
 
 }
 }
 
 
 Log File :
 
 [08:20:54.64] [INFO] Assembly version: 3.0.2.79.
 [08:20:54.64] [INFO] Will login as "reports@findmaps.co.uk".
 [08:20:54.66] [INFO] Will try regular LOGIN authentication.
 [08:20:54.67] [SEND] MBN00000001 LOGIN "reports@AAAA.co.uk" "********"\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 "reports@AAAA.co.uk".
 [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 "mail.AAAA.co.uk".
 [08:21:23.18] [INFO] Disconnected from host "mail.AAAA.co.uk".
 
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Andrew AfterLogic Support
 
  
 
 Joined: 28 April 2006
 Location: United States
 Online Status: Offline
 Posts: 1189
 | 
          We've just rechecked the command which causes the issue:
           | Posted: 14 April 2008 at 6:30am | IP Logged |   |  
           | 
 |  
 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,
 Andrew
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | jamesj3k Newbie
 
  
  
 Joined: 21 June 2011
 Location: United States
 Online Status: Offline
 Posts: 1
 | 
          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.
           | Posted: 21 June 2011 at 12:04pm | IP Logged |   |  
           | 
 |  
 For example: imap.MoveMessages(strUids, true, "INBOX.saved");
 | 
       
        | Back to Top |       | 
       
       
        |  |