IMAP - editing a project or existing message?

For those who are familiar with IMAP. If I get a draft message (or any message, for that matter) and I want to update / edit it, which commands should I use?

The only command I came across is Append , which appears only for insertion, that is, will I need to delete the previous draft from the mailbox?

+4
source share
2 answers

IMAP is intended for managing mailboxes on the server side, and not for editing messages. So yes, you will need to get the contents of the required message ( FETCH ), and then delete this message from the server ( STORE a \Deleted in the message and then EXPUNGE deleted messages), and then upload the updated message to the server ( APPEND ). There are no IMAP commands for editing the contents of an existing message, only for updating flags associated with existing messages ( STORE ).

+10
source

Remy's answer is correct. In addition, you can optimize the process a little if the server supports the CATENATE extension using APPEND CATENATE (so that you can save the loading of existing attachments, etc.).

+4
source

Source: https://habr.com/ru/post/1484680/


All Articles