[Dovecot] [Q] IMAP update message header?
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?
TIA (and sorry for the off topic posting), Rod
On May 7, 2008, at 5:50 PM, Roderick A. Anderson wrote:
Is there a method as a client from a remote system to make changes
to a message then save it back?
IMAP messages are immutable. The only way to modify an existing
message is to save a new message and expunge the old one.
On 5/7/2008, Roderick A. Anderson (raanders@acm.org) wrote:
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?
Man, if you could, that would be really, really bad...
So hopefully the answer is no, not, never...
:)
--
Best regards,
Charles
Charles Marcus wrote:
On 5/7/2008, Roderick A. Anderson (raanders@acm.org) wrote:
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?
Man, if you could, that would be really, really bad...
Does make sense in the bigger picture but for my needs is would only be kind-of bad. :-)
So hopefully the answer is no, not, never...
Well Timo's answer indicates so. So now I'm trying to figure out a way to get the same effect as marking a message as seen/unseen while honoring seen/unseen.
Looks like it will probably be a case of making a copy of the message adding the X-Header then copying/savinging it back as a new message and deleting the old.
Rod
- Timo Sirainen, 2008-05-07 17:54
On May 7, 2008, at 6:45 PM, Roderick A. Anderson wrote:
Looks like it will probably be a case of making a copy of the message adding the X-Header then copying/savinging it back as a new message and deleting the old.
How about just using keywords?
Does anybody know why all of Timo's mails that are sent with Apple Mail show up as "OpenPGP: Error - signature verification failed; click Pen icon for details" in Thunderbird 2.0.0.x/Enigmail 0.95.6?
The details just say:
| OpenPGP Security Info
|
| Error - signature verification failed
|
| gpg command line and output:
| /usr/local/bin/gpg --charset utf8 --batch --no-tty --status-fd 2
| --keyserver-options auto-key-retrieve --keyserver subkeys.pgp.net --verify
| gpg: Signature made Mit 07 Mai 2008 17:54:30 CEST using DSA key ID 40558AC9
| gpg: BAD signature from "Timo Sirainen <tss@iki.fi>
OTOH, everything seems to be fine with Mutt 1.4.2.2i:
| [-- PGP output follows (current time: Mit 07 Mai 2008 18:28:17 CEST) --]
| gpg: Signature made Mit 07 Mai 2008 17:54:30 CEST using DSA key ID 40558AC9
| gpg: Good signature from "Timo Sirainen <tss@iki.fi>"
| gpg: WARNING: This key is not certified with a trusted signature!
| gpg: There is no indication that the signature belongs to the owner.
| Primary key fingerprint: E643 F0BD FDCD 04D9 FFCB 6279 C948 5251 4055 8AC9
| [-- End of PGP output --]
|
| [-- The following data is signed --]
|
| On May 7, 2008, at 6:45 PM, Roderick A. Anderson wrote:
| >Looks like it will probably be a case of making a copy of the
| >message adding the X-Header then copying/savinging it back as a new
| >message and deleting the old.
|
| How about just using keywords?
|
|
| [-- End of signed data --]
Is it the way that Apple Mail includes the signature in some sort of pseudo inline attachment that breaks TB's/Enigmail's MIME and/or PGP handling? Is mutt more robust, tolerant and/or sophisticated in terms of handling PGP? Just curious ...
Thanks, Thomas
On Wed, 2008-05-07 at 19:30 +0200, Thomas Zajic wrote:
- Timo Sirainen, 2008-05-07 17:54
On May 7, 2008, at 6:45 PM, Roderick A. Anderson wrote:
Looks like it will probably be a case of making a copy of the message adding the X-Header then copying/savinging it back as a new message and deleting the old.
How about just using keywords?
Does anybody know why all of Timo's mails that are sent with Apple Mail show up as "OpenPGP: Error - signature verification failed; click Pen icon for details" in Thunderbird 2.0.0.x/Enigmail 0.95.6?
http://lists.gnupg.org/pipermail/gnupg-users/2008-March/032840.html
I haven't bothered to do anything about it. It gets eventually fixed once you upgrade your gpg.
- Timo Sirainen, 2008-05-07 19:41
On Wed, 2008-05-07 at 19:30 +0200, Thomas Zajic wrote:
- Timo Sirainen, 2008-05-07 17:54
On May 7, 2008, at 6:45 PM, Roderick A. Anderson wrote:
Looks like it will probably be a case of making a copy of the message adding the X-Header then copying/savinging it back as a new message and deleting the old. How about just using keywords?
Does anybody know why all of Timo's mails that are sent with Apple Mail show up as "OpenPGP: Error - signature verification failed; click Pen icon for details" in Thunderbird 2.0.0.x/Enigmail 0.95.6?
http://lists.gnupg.org/pipermail/gnupg-users/2008-March/032840.html
I haven't bothered to do anything about it. It gets eventually fixed once you upgrade your gpg.
Okay, so it's a gnupg thing? But both mutt and enigmail use the same version of gpg internally, though, and it's the latest one available AFAIK:
[zlatko@disclosure]:~$ gpg --version | head -1 gpg (GnuPG) 1.4.9
By "once you upgrade your gpg" do you mean I should be using gnupg2 instead?
[zlatko@disclosure]:~$ gpg2 --version | head -1 gpg (GnuPG) 2.0.9
Thanks, Thomas
On Wed, 2008-05-07 at 21:38 +0200, Thomas Zajic wrote:
Does anybody know why all of Timo's mails that are sent with Apple Mail show up as "OpenPGP: Error - signature verification failed; click Pen icon for details" in Thunderbird 2.0.0.x/Enigmail 0.95.6?
http://lists.gnupg.org/pipermail/gnupg-users/2008-March/032840.html
I haven't bothered to do anything about it. It gets eventually fixed once you upgrade your gpg.
Okay, so it's a gnupg thing? But both mutt and enigmail use the same version of gpg internally, though, and it's the latest one available AFAIK:
[zlatko@disclosure]:~$ gpg --version | head -1 gpg (GnuPG) 1.4.9
Oh. I thought 1.4.8 and later would have verified it as valid. For some reason gnupg in Debian unstable is stuck at v1.4.6 so I haven't tested it myself yet.
So if that didn't help, I'm not sure then what the problem is. Unless your version tries to verify the mails using the old format. Wonder if it's possible to tell GPGMail to use the old format or not use textmode at all .. other than by creating a gpg wrapper script, which I'm a bit lazy to do. :)
- Timo Sirainen, 2008-05-07 22:02
On Wed, 2008-05-07 at 21:38 +0200, Thomas Zajic wrote:
Okay, so it's a gnupg thing? But both mutt and enigmail use the same version of gpg internally, though, and it's the latest one available AFAIK:
[zlatko@disclosure]:~$ gpg --version | head -1 gpg (GnuPG) 1.4.9
Oh. I thought 1.4.8 and later would have verified it as valid. For some reason gnupg in Debian unstable is stuck at v1.4.6 so I haven't tested it myself yet.
So if that didn't help, I'm not sure then what the problem is. Unless your version tries to verify the mails using the old format. Wonder if it's possible to tell GPGMail to use the old format or not use textmode at all .. other than by creating a gpg wrapper script, which I'm a bit lazy to do. :)
:-)
I think that it's a different problem than the one mentioned in the gnupg mailing list post you refered to. The funny thing is that it's actually exactly the other way round than you'd expect from that post:
The mails that you send from your Debian system using Evolution (which in turn uses gnupg-1.4.6 internally, ie. an "old" version) are verified just fine by Enigmail (which uses gnupg-1.4.9 internally, ie. a "new" version) even without any of the "--rfc2440" or "--rfc2440-text" parameters.
It's only the mails you send from your Mac using Apple Mail that show up with a bad signature in TB/Enigmail, although Apple Mail uses gnupg-1.4.8 internally (ie. also a "new" version, just like the one Enigmail uses). But even with "--rfc2440" or "--rfc2440-text", Enigmail is still unable to verify the signature.
Mutt, OTOH, using the very same gnupg-1.4.9 that Enigmail uses internally, is perfectly happy and able to verify the signatures from both Evolution and Apple Mail, without any additional parameters modifying gpg's default behaviour.
According to gnupg-1.4.9's ChangeLog, the only change that might be related to this problem is the following:
| 2008-03-07 David Shaw <dshaw@jabberwocky.com> | | * configure.ac: Darwin's /bin/sh has a builtin echo that doesn't | understand '-n'. Use tr to trim the carriage return instead.
I have no idea whether gnupg actually relies on /bin/sh to do any of its stuff, or if this is only relevant for ./configure. Oh well ... it's not a big problem anyway, so I don't want to waste your precious time that you'd probably rather spend getting dovecot-1.1 out the door. :-)
Thanks anyway, Thomas
On May 8, 2008, at 8:24 AM, Thomas Zajic wrote:
The mails that you send from your Debian system using Evolution
(which in turn uses gnupg-1.4.6 internally, ie. an "old" version) are verified
just fine by Enigmail (which uses gnupg-1.4.9 internally, ie. a "new"
version) even without any of the "--rfc2440" or "--rfc2440-text" parameters.
I think Evolution doesn't use the --textmode (or similar) parameters
at all, so it doesn't matter which gpg version is used. So this could
probably be solved by dropping the --textmode parameter from GPGMail's
gpg call.
Mutt, OTOH, using the very same gnupg-1.4.9 that Enigmail uses
internally, is perfectly happy and able to verify the signatures from both
Evolution and Apple Mail, without any additional parameters modifying gpg's
default behaviour.
That's weird. :)
On Wed, 7 May 2008, Roderick A. Anderson wrote:
Charles Marcus wrote:
On 5/7/2008, Roderick A. Anderson (raanders@acm.org) wrote:
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?
Man, if you could, that would be really, really bad...
Does make sense in the bigger picture but for my needs is would only be kind-of bad. :-)
So hopefully the answer is no, not, never...
Well Timo's answer indicates so. So now I'm trying to figure out a way to get the same effect as marking a message as seen/unseen while honoring seen/unseen.
Looks like it will probably be a case of making a copy of the message adding the X-Header then copying/savinging it back as a new message and deleting the old.
Is there any reason you couldn't just add a flag?
IMAP-wise it's:
label STORE message-id +FLAGS (FlagName)
and
label FETCH message-id FLAGS
e.g. [trimmed a little]
- OK Dovecot ready. A LOGIN user pass A OK Logged in. B SELECT INBOX
- FLAGS (\Answered \Seen [.etc.])
- OK [PERMANENTFLAGS (\Answered \Seen ... \*)] Flags permitted.
- 30129 EXISTS
- 0 RECENT
- OK [UNSEEN 408] First unseen.
- OK [UIDVALIDITY 1202523566] UIDs valid
- OK [UIDNEXT 153176] Predicted next UID B OK [READ-WRITE] Select completed. C FETCH 30029 FLAGS
- 30029 FETCH (FLAGS (\Seen)) C OK Fetch completed. D STORE 30029 +FLAGS (SeenByProcess)
- FLAGS (\Answered \Seen [.etc.] SeenByProcess)
- OK [PERMANENTFLAGS (\Answered \Seen ... SeenByProcess \*)] Flags permitted.
- 30029 FETCH (FLAGS (\Seen SeenByProcess)) D OK Store completed.
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:
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.
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@scconsult.com
On Wed, 2008-05-07 at 14:05 -0400, Bill Cole wrote:
- 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.
IMAP RFC also calls them keywords. :)
participants (6)
-
Benjamin R. Haskell
-
Bill Cole
-
Charles Marcus
-
Roderick A. Anderson
-
Thomas Zajic
-
Timo Sirainen