This project is read-only.

How to create new mail message?

Jun 7, 2008 at 6:07 PM
Hi!
I know this is a dumb question but I don't see a method to create a new empty message. I'd like to create empty message and save it in Inbox/Drafts folder.

As far as I know I'd have to make new IMAPMessage object, set its _uid and _client fields and use CopyMessageToFolder method of "Input/Drafts" IMAPFolder. Am I right?

Thanks in advance!

Jun 8, 2008 at 2:05 AM
Creating a new message isn't really an available function in the IMAP specification. The UID of a message is dictated by the e-mail server, so simply setting it yourself will not work. Even if you could create an IMAPMessage object and add it to a folder, there is nothing on the server to support that operation, and therefore the message would not exist if you viewed the same account with another client.

The CopyMessageToFolder method expects that the specified message exists in the folder the message copy is being called from, and it will look on the server for the UID of that message.
Jun 8, 2008 at 11:16 AM
Hmm... damn... thanks for explanation!

But how is it possible for Gmail web client and Thunderbird to save a draft of the message in Drafts folder (draft is available and visible for both clients)? Is it some kind of non-standard feature?

Thanks again for answers!

Jun 8, 2008 at 4:20 PM
I sit corrected. You brought up an interesting point, so i took another look and there is an IMAP command called APPEND that is designed to 'append' a message to the end of a folder. I will put together a method to do this and update the code once its ready.

Thanks for your posts!

Jason
Jun 8, 2008 at 6:42 PM
No problem! Thank you for your support and knowledge. InterIMAP is really great!

Have a good day :)