Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: IMAP: mark message as unseen

by Corion (Pope)
on Jul 03, 2018 at 11:02 UTC ( #1217810=note: print w/replies, xml ) Need Help??


in reply to IMAP: mark message as unseen

I think the \Seen flag is set automatically by the IMAP server whenever any client retrieves a message body. At least in my (automated) IMAP clients, I have resorted to programmatically remove the \Seen flag on mails that I retrieve. Looking at Mail::IMAPClient, there is mention of the Peek flag, which should let the IMAP server know that the mail should remain unread. I haven't tried this, but it could work like this:

$imap->Peek(1); # don't mark mails as \Seen automatically my @unseen = reverse sort $imap->search_unseen; for my $i (@unseen) { my $msg = join '', @{$imap->get($i)}; unless (fork) { if (&process (Email::MIME->new (\$msg)) eq "notouch") { $imap->unsee ($i); exit; } } }

Replies are listed 'Best First'.
Re^2: IMAP: mark message as unseen
by Arik123 (Sexton) on Jul 10, 2018 at 09:30 UTC

    Okay, the PEEK things works... temporarily (it isn't implemented in Net::IMAP::Simple::SSL, but I did it manually). After fetching the messages using the PEEK thing, the web interface shows that the messages are still unread. However, if I wait a few moments without any action, and then re-load the web interface, the messages are marked as Seen.

    Any idea what is going on? Thanks a lot!

      Sorry, it was probably my mistake.

      However, the PEEK method doesn't yet work perfectly (I'm trying to figure out why). Is there any alternative?

        I think before I discovered PEEK, I removed the \Seen flag from each message after reading it, but I don't find any code anymore in which I did that and how I did it, sorry.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1217810]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2019-04-23 08:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I am most likely to install a new module from CPAN if:
















    Results (115 votes). Check out past polls.

    Notices?