[Dovecot] [Q] IMAP update message header?
Bill Cole
dovecot-20061108 at billmail.scconsult.com
Wed May 7 21:05:57 EEST 2008
At 7:50 AM -0700 5/7/08, Roderick A. Anderson wrote:
>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.)
This is a bad idea. Adding any header to a delivered message is
simply wrong on principle. IMAP requires that message headers and
bodies do not change.
>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.
You've read RFC3501 and missed section 2.3.1.1?
Messages in IMAP are supposed to be *immutable* as far as all header
and body data is concerned.
>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?
The two ways you could go with this are:
1. Instead of using a header, use an IMAP flag. One of the standard
flags might suffice (i.e. '\Seen') but you can also come up with your
own
custom flags, which the Dovecot docs refer to as "keywords." These
are set with the IMAP STORE command.
2. If you are absolutely locked in to an added header, you could
delete the original message, create a modified version, and use the
IMAP APPEND command to write the modified message back to a mailbox.
--
Bill Cole
bill at scconsult.com
More information about the dovecot
mailing list