More about IMAP, less about Dovecot.
This is more an IMAP question than specifically about Dovecot. Sorry to ask here but I've been researching, reading and lurking with no answer so far.
What I'm doing is running reports as a user from a remote system to provide a list of messages (Sender/From, Subject, Date, size) in a specific folder(?). In one case it isn't even a Dovecot based server so I only have access as a client. (Though I use Dovecot on several other systems and will need this capability for them.)
When a message in the folder has been reported I'd like to add a X-Header-??? indicating that the message has been reported so the next time through it isn't reported again. (After the message is X days old it is deleted.)
These reports are run using Perl and I've tried most every CPAN module available but haven't figured out how to change/add a header then save the message back. So far I haven't been able to determine if this is even possible by reading the RFCs.
Is there a method as a client from a remote system to make changes to a message then save it back? What is the IMAP verb, command, etc. to do this? Or if there are Perl programmers on the list a brief description (or code) for doing this?