AppendMessage - IMAP007 BAD Could not parse command

Jun 27, 2008 at 5:58 AM
Hi,
        
         Debug log message  display - IMAP007 BAD Could not parse command.  The message cannot append to Drafts folder. 
         Any some idea save the email  message to server.        Would you mind helping me .
            On the other hand, i want to send out email via InterIMAP  Library . Do you have an example code.
. Thank


Jonathan     


------------------------------------
code
------------------------------------
          //IMAPConfig config = new IMAPConfig("<host>", "<username>", "<password>", false, true, "");
            //config.SaveConfig("settings.cfg");
         // i using gmail IMAP account
            IMAPConfig config = new IMAPConfig(@"c:\temp\test1.cfg");
            config.CacheFile = "";
            
            IMAPClient client = null;
            try
            {
                client = new IMAPClient(config, null, 5);
                client.Logon();
            }
            catch (IMAPException e)
            {
                Console.WriteLine(e.Message);
                return;
            }


            IMAPFolder drafts = client.Folders["Drafts"];
            

            IMAPMessage newMessage = new IMAPMessage();
            newMessage.From.Add(new IMAPMailAddress("Jason Miesionczek", "xwvxwvx@gmail.com"));
            newMessage.To.Add(new IMAPMailAddress("Jason Miesionczek", "jason@reprisemedia.com"));
            newMessage.Date = DateTime.Now;
            newMessage.Subject = "this is a new message";
            drafts.AppendMessage(newMessage, "this is the content of the new message");

            Console.ReadLine();
Coordinator
Jun 27, 2008 at 1:40 PM
As the comments in the changeset on the source code page mention, the AppendMessage method is present, but not currently working. I have not been able to determine what is causing the erorr that is being returned from the IMAP server. Once i do discover the solution i will be sure to update the code.

Sending email is not a function of an IMAP server. you need SMTP for that. .NET has built-in classes for accomplishing this which im sure a quick google search will provide the answer you seek.