On Wed, 28 Apr 2010, Mike Eggleston might have said: > On Wed, 28 Apr 2010, Dan White might have said: > > > On 28/04/10 09:43 -0500, Mike Eggleston wrote: > > >cd /var/spool/imap > > >find user/$user -type d -print | sed 's,/,.,g' | sed 's/^/"/' | sed > > >'s/$/"/' | while read folder > > >do > > > echo 1 select $folder > /tmp/c1 > > > echo "2 uid store 1:* +flags (\seen)" >> /tmp/c1 > > > echo 3 logout >> /tmp/c1 > > > imtest -a cyrus -w $password -u ejsg localhost < /tmp/c1 > > >done > > > > > >I found no errors from the command's output, nor did I find any errors in > > >/var/log/maillog, but the user says the message is still marked 'unread' > > >by Outlook. > > > > Is $user and ejsg the same user? > > > > Be sure to pass the same user in the '-u xxx' option of the imtest command, > > that you wish to set the seen changes for. > > > > Cyrus uses per-user seen states (by default), so setting the \Seen flag for > > user jane, when authorizing as ejsg, will not do what you want. > > I just realized that error. The names $user and ejsg are the same. The > imtest command is setting the \Seen flags for user 'cyrus' not user > 'ejsg'. I'm writing a simple cgi-bin program so the users can reset > their own \Seen flags. I'll post it as soon as I'm done. > > Mike My current, not ready for prime time script is: ------------------------------------------ #!/bin/sh # $Id$ # $Log$ # must be run as root # cd /var/spool/imap/? # then run a find to get all folders for a user # then update all messages in each folder with the \Seen flag # globals user=$1 pass=$2 # am I root? id=`id -u` if [ $id -ne 0 ] ; then echo "$0: must be run as root; aborting" exit 1 fi # is there a valid user given as argument 1? id "$user" 2>&1 > /dev/null if [ $? -ne 0 ] ; then echo "$0: unknown user '$user'; aborting" exit 2 fi # does that user have mail directory? fl=`echo $user | cut -c1` imapdir=/var/spool/imap letterdir="$imapdir/$fl" if [ ! -d $letterdir ] ; then echo "$0: directory '$letterdir' does not exist; aborting" exit 3 fi userdir="$letterdir/user/$user" if [ ! -d $userdir ] ; then echo "$0: directory '$userdir' does not exist; aborting" exit 4 fi # find all folders in the user's account # give each folder individually to imaptest for setting the \Seen flag tf=/tmp/.cyrus-mark-read.$$ cd $letterdir find "user/$user" -type d -print | sed 's,/,.,g' | sed 's/^/"/' | sed 's/$/"/' | while read folder do echo "1 SELECT $folder" #echo "2 uid fetch 1:* flags" echo '3 UID STORE 1:* +FLAGS (\SEEN)' done > $tf echo "4 LOGOUT" >> $tf # run the above generated commands imtest -a $user -w $pass -u $user localhost < $tf # clean up rm -f $tf ------------------------------------------ ---- Cyrus Home Page: http://cyrusimap.web.cmu.edu/ Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html