[RCD] How to mark a message unread?

Rob Sheldon rob at associatedtechs.com
Mon Sep 10 15:34:49 CEST 2012


Hi,

I'm trying to mark a saved message unread in markasjunk2's cmd_learn 
driver. The set_flag() function appears to be succeeding, but the 
message is not showing up as unread in the user's inbox. (markasjunk2 
won't detach spamassassin messages if you use its cmd_learn driver (and 
even if it did, it would choke on my spamassassin config, 
unfortunately).)

I compared what I'm doing to the mail/mark.inc file, and I can't figure 
out what I'm doing wrong. I've reviewed the dev docs but didn't find 
anything helpful there. I was hoping somebody could point me in the 
right direction. Here's the current relevant code:

//   Got message to move as $message
foreach ($message->parts as $part) {
         if ( array_key_exists('x-spam-type', $part->ctype_parameters) 
&& $part->ctype_parameters['x-spam-type'] == 'original' )
         {
                 $saved = $storage->save_message('INBOX', 
$storage->get_message_part($message->uid, $part->mime_id, $part));

                 if ($saved !== false) {
                         $storage->set_flag(array($saved), 'UNSEEN');
                         
$rcmail->output->command('rcmail_markasjunk2_move', null, $uid);
                         array_push($new_uids, $saved);
                 }
         }
}
//

$saved appears to be a good message UID, but maybe there's some other 
step missing that I'm not aware of? This code is being inserted into the 
ham() function in the current version of cmd_learn.php.

Thanks.

And btw, if this is the wrong list for questions like this, please let 
me know.

- R.

-- 
[__ Robert Sheldon
[__ No Problem
[__ Information technology support and services
[__ (530) 575-0278


More information about the dev mailing list