Search code examples
imapwebmail

imap command for save a message to draft


i'm building a simple webMail and use imap protocol. i want to add draft option to my webmail & need an imap command for save a message(which not completed composition) in draft folder? could anybody help me?


Solution

  • Use the APPEND command. It doesn't matter if the message is incomplete. As long as it's a properly formatted email with a header and a body, you can add it to a folder.

    APPEND is in fact the only command that exists in IMAP that allows you to add new content to the remote server, so you would use the same command to save the completed message to a "Sent" folder.