Marking messages unread with imap [linux]

370 views
Skip to first unread message

Matthew Kitson

unread,
Jun 5, 2002, 3:40:45 PM6/5/02
to
Hello,

I've got a machine running RedHat linux using fetchmail to retreive
messages from an imap server. This works fine, but I have the following
problem.

Occasionally, I use another machine to read my emails, which marks the
messages unread. When I then use my own machine, fetchmail igmores these
messages (as it thinks that they have already been downloaded).

Does anyone know of a simple (linux) program that I can use to mark all
messages later than a certain date as unread, so that I can then
download them properely?

Many thanks,

Matthew Kitson.

those who know me have no need of my name

unread,
Jun 6, 2002, 1:36:01 AM6/6/02
to
in comp.mail.imap i read:

>Does anyone know of a simple (linux) program that I can use to mark
>all messages later than a certain date as unread, so that I can then
>download them properely?

most imap mua's, e.g., mutt. if you need it to be non-interactive then you
can use php or write an expect script to control an mua.

--
bringing you boring signatures for 17 years

Nancy McGough

unread,
Jun 6, 2002, 2:20:19 AM6/6/02
to
On 5 Jun 2002 Matthew Kitson (mki...@lineone.net) wrote:
> Occasionally, I use another machine to read my emails, which marks the
> messages unread. When I then use my own machine, fetchmail igmores these
> messages (as it thinks that they have already been downloaded).
>
> Does anyone know of a simple (linux) program that I can use to mark all
> messages later than a certain date as unread, so that I can then
> download them properely?


I don't know of a utility that does that (and I also don't
understand why you'd want to throw away the read/unread status),
but one possibility is to use a more IMAP-friendly tool than
fetchmail. For example imapmove. Here's the top of the man page:


--- BEGIN excerpt of imapcopy, imapmove man page ---

imapcopy(LOCAL) imapcopy(LOCAL)

NAME
imapcopy, imapmove - copy or move messages from an IMAP
inbox to a local mailbox

SYNTAX
imapcopy [-debug] [-verbose] host [mailbox]

imapmove [-debug] [-verbose] host [mailbox]

DESCRIPTION
imapcopy and imapmove establish an IMAP connection with
the named host and transfer messages from the IMAP INBOX
on that host to the named destination mailbox . If the
mailbox is not specified, the default is the local INBOX.

imapmove removes (deletes and expunges) the messages the
messages from the IMAP INBOX on host after transferring
them to the destination mailbox .

imapcopy and imapmove require that the destination mailbox
exist; otherwise they will print an error message and exit
without transferring any messages.

--- END excerpt of imapcopy, imapmove man page ---


This and some other IMAP utilities are available through the
IMAP Information Center at

<http://www.washington.edu/imap/>


It's also in my Miscellaneous IMAP Tools, which is here

<http://www.ii.com/internet/messaging/imap/isps/#toolsMisc>

If anyone knows of IMAP tools I can add to my list, please let me
know.

Thanks,
Nancy


REFERENCE:
The message I'm replying to -- and this entire thread & group --
may be available at

<http://groups.google.com/groups?selm=3CFE693D...@lineone.net>


--
PROCMAIL <http://www.ii.com/internet/robots/procmail/qs/>
IMAP <http://www.ii.com/internet/messaging/imap/isps/>
PINE <http://www.ii.com/internet/messaging/pine/>

-- I N F I N I T E I N K www.ii.com N A N C Y M c G O U G H --

those who know me have no need of my name

unread,
Jun 6, 2002, 7:35:53 PM6/6/02
to
in comp.mail.imap i read:

>On 5 Jun 2002 Matthew Kitson (mki...@lineone.net) wrote:

>> Does anyone know of a simple (linux) program that I can use to mark all
>> messages later than a certain date as unread, so that I can then
>> download them properely?

>I don't know of a utility that does that (and I also don't
>understand why you'd want to throw away the read/unread status),
>but one possibility is to use a more IMAP-friendly tool than
>fetchmail. For example imapmove. Here's the top of the man page:

i don't see how imapcopy or imapmove differ from fetchmail; imapcopy being
approximately `fetchmail -K host' and imapmove `fetchmail -k host'.

Frank Klauert

unread,
Jun 7, 2002, 10:08:43 AM6/7/02
to
A rant about fetchmail, because I'm really glad that I got rid
of this p**** of s*** ...

>
> Occasionally, I use another machine to read my emails, which marks the
> messages unread. When I then use my own machine, fetchmail igmores these
> messages (as it thinks that they have already been downloaded).


The author of fetchmail has a big problem of understanding the concept of
unique message IDs and lives in the past.

He abuses the seen flag of IMAP instead of simply storing which UIDs
it has seen, and which not, and keeping track of them.
This would be the right approach, because it would actually fetch all
new mail, and leave all seen mail alone, not caring for any other
access to the postbox from other computers.


He uses as similar broken approach for POP3 as for IMAP:

He want's the author of POP3 to be hung and he wants to keep POP2, because
there was a LAST-command.
If you think about the implications of relying on that command, you can
see that he's not able to think of people who check mail from two different
computers like you.


From ESR's homepage:

"
O9. Why does fetchmail keep retrieving the same messages over and over?
First, check to see that you haven't enabled the keep and fetchall option. If you have, turn keep off.
There are various forms of lossage involving the POP3 UIDL feature that can lead to all your old messages being seen again after a
line drop. I have given up trying to fix these, as the UIDL code breaks worse every time I touch it. The problem is fundamental;
maintaining and garbage-collecting the right kind of client-side state is just hard. Whoever put UIDLs in RFC1725 and removed LAST
should be hung up by his thumbs and whipped with scorpions. The right answers are either (a) live with the occasional breakage, (b)
switch to IMAP4, or (c) fix the code yourself and send me a patch. Unless you choose (c), I don't want to hear about it.
"

Maybe ESR is too involved in prasing how great he is, that Mozilla is
only his effort because he wrote such a great document about open source
or he simply can't take the fact that his masterpiece acutually has a
very bad design. But what do you expect from software which has only
been "hacked" (he even didn't start with his own code, but something called
pop-client and is proud of it) on, but which was never _designed_ or thought
about...

Fetchmail can't even check a dozend POP3-servers in parallel to
save dialuptime...


>"maintaining and garbage-collecting the right kind of client-side state
>is just hard"
Haha! Keeping track of UIDs in POP3 is a task for one or two afternoons
to get a complete perfectly working (but not configureable) replacement for
fetchmail (which also sorts mails in different folders and uploads them to
my local imap-server via c-client) if you use a component like
http://www.naughter.com/pop3.html (which has no tracking of know UIDs in it).


>
> Does anyone know of a simple (linux) program that I can use to mark all
> messages later than a certain date as unread, so that I can then
> download them properely?
>

Unfortunately I don't know about one.


You could ask ESR to include UID-support for IMAP (or am I completely
wrong with everthing I write and he has included that?) (but don't forget
to post it here!) or you could try the "fetchall"-option. Together with
"flush" it might do exactly what you want, or do you want to keep mail
on the IMAP-server, too?


If you only need an inbox, then IMAP seems to be a little bit wrong
for you, you could switch to POP3 for that (if your ISP supports it).
IMAP is IMHO best used if you want to access the same mails (in
multiple folders!) from everywhere, and synchronize between them.
If you don't need that, switching to POP3 should remove your problems
with fetchmail.

But if you really want to _synchronise_ mail, try
http://mailsync.sourceforge.net/


One maybe rather good idea that might actually help you (instead
of hearing my anger against fetchmail) is that you could use an IMAP
to POP3 proxy (Sorry that I don't know one). Install it localy on your
computer and use fetchmail in POP3-mode.
It will then use UIDS and that should do what you want. (Of course
the generation of uids in the proxy must be based on the imap-uids.
And in the rare case that there is a LAST-command, you must configure
it to disable it)
This would also save you from modifying the way mail gets from fetchmail
to your folders.


PS: (Found on the web, poorly translated)

No wonder that Eric Raymond is so keen of weapons. If I would delete
the emails of the users of my software so regularly, self-defense would
also be on top of my list.

(original:
Wenn du fetchmail einsetzt, ist es nicht so schlimm, weil fetchmail die
Mail möglicherweise wegwirft, bevor sie bei Exim ankommt. Ich kenne
niemanden, der fetchmail schon mal eingesetzt hat, und damit keine Mail
verloren hat. Diese Software gehört in einer Sondermülldeponie
fachgerecht entsorgt. Kein Wunder, daß Eric Raymond so auf Schußwaffen
steht. Wenn ich den Usern meiner Software mit so schöner Regelmäßigkeit
Mails löschen würde, wäre Selbstverteidigung auch ganz oben auf meiner
Liste.)


Reply all
Reply to author
Forward
0 new messages