Bill Shirley
2016-Nov-10 08:46 UTC
How does one mark all messages as read (imap4flag "seen") with sieve?
I don't use the Anti-Spam plugin; I just fire off a BASH script every four hours with crontab which iterates thru the vmail email accounts and trains Spamassassin 'per-user' accounts. If the script sounds interesting I can post it here. It probably could use a little polish though. Bill On 11/9/2016 6:49 PM, Ben Johnson wrote:> On 11/5/2016 1:22 PM, Larry Rosenman wrote: >> What OS/MTA are you using? Can you give me (privately if you want) a >> re-hash of the LDA issues? >> >> I'm using FreeBSD 10.3 / Exim for my set up and LMTP for ALL deliveries, >> and it works great. > Thanks again for your willingness to help with this, Larry. > > I'm using Postfix. > > Regarding the OS, I'm using Ubuntu 16.04 here, which ships dovecot > 2.2.22 at present. > > ---- Slightly off-topic, but I'll bring it full-circle... ---- > > Sure, a quick recap of the crashing issue I'm having with dovecot-lda: > > I struggled to get this working the first time (in dovecot 2.0.19), but > prevailed with lots of help from this list. I described the roadblocks I > encountered along the way in this thread: > > http://www.dovecot.org/list/dovecot/2013-June/091018.html > > All was well until I upgraded from Ubuntu 12.04 LTS to 14.04 LTS and > thereby from Dovecot 2.0.19 to 2.2.9. To be clear (and it may be very > relevant), this was a "manual" server migration and not an > OS-level/package-managed upgrade. Point being, the potential to botch > some aspect of the extremely fragile configuration was absolutely present! > > I wrote about the problems I encountered after the upgrade here: > > http://www.dovecot.org/list/dovecot/2014-July/097234.html > > The thread died-out, but I rekindled it here: > > http://www.dovecot.org/list/dovecot/2014-August/097385.html > > I ran out of steam after a soft dead-end. > > I wrote more about it a couple months later, mostly in the context of > difficulty with dovecot-lda logging in an effort to debug the issue, but > the thread received no replies: > > http://www.dovecot.org/list/dovecot/2014-October/098127.html > > Nearly two years later, I tried again: > > http://www.dovecot.org/list/dovecot/2016-August/105221.html > > The thread received some traction, and I changed the subject line to be > more accurate partway through, which begins here: > > http://www.dovecot.org/list/dovecot/2016-August/105236.html > > I ended-up running with Karol's final suggestion, which was to forego > the LDA in favor of a simple filesystem move/copy operation. > > But now the problem I'm having (to bring it full circle!) is that I > can't mark the Antispam plugin's incoming emails as seen/read > automatically because they aren't delivered by an LDA. And I want to get > this working with an LDA again for this reason, among others, such as > quotas not being enforced when a "trained" message is "copied" on the > filesystem instead of "delivered" via an LDA. > > The more I think about this, the more I think I should go back and study > the very first thread from June, 2013... maybe the solution is more or > less the same! > > -Ben
Ben Johnson
2016-Nov-11 01:29 UTC
How does one mark all messages as read (imap4flag "seen") with sieve?
On 11/10/2016 3:46 AM, Bill Shirley wrote:> I don't use the Anti-Spam plugin; I just fire off a BASH script every > four hours with > crontab which iterates thru the vmail email accounts and trains > Spamassassin 'per-user' > accounts. If the script sounds interesting I can post it here. It > probably could use a little polish > though. > > BillThanks, Bill! Sure, please do share the script, if it's not too much trouble. For my specific use-case, I've been maintaining a "corpus" of known ham/spam messages, and enjoy being able to hand classify/re-classify/ignore if necessary. But I do see the appeal of training with a single script that iterates through each user's mailbox. Heretofore, my thinking has been that combining all "submitted" spam, which is piped into the training mailbox automatically, whenever a user drags from Inbox -> Spam (or vice versa), I have a much broader sample of the the ham and spam out there. And yes, a "shared" corpus among all users does seem to "dilute" specific individuals' would-be training preferences a bit, but the trade-off seems worthwhile. Interesting quandary... I would love to see the script! No problem if it's a bit "rough around the edges"; the overall concept and approach are what's important to me. -Ben
Bill Shirley
2016-Nov-11 17:52 UTC
How does one mark all messages as read (imap4flag "seen") with sieve?
This one is for vmail which is attached. Bill On 11/10/2016 8:29 PM, Ben Johnson wrote:> On 11/10/2016 3:46 AM, Bill Shirley wrote: >> I don't use the Anti-Spam plugin; I just fire off a BASH script every >> four hours with >> crontab which iterates thru the vmail email accounts and trains >> Spamassassin 'per-user' >> accounts. If the script sounds interesting I can post it here. It >> probably could use a little polish >> though. >> >> Bill > Thanks, Bill! > > Sure, please do share the script, if it's not too much trouble. > > For my specific use-case, I've been maintaining a "corpus" of known > ham/spam messages, and enjoy being able to hand > classify/re-classify/ignore if necessary. > > But I do see the appeal of training with a single script that iterates > through each user's mailbox. > > Heretofore, my thinking has been that combining all "submitted" spam, > which is piped into the training mailbox automatically, whenever a user > drags from Inbox -> Spam (or vice versa), I have a much broader sample > of the the ham and spam out there. > > And yes, a "shared" corpus among all users does seem to "dilute" > specific individuals' would-be training preferences a bit, but the > trade-off seems worthwhile. > > Interesting quandary... I would love to see the script! No problem if > it's a bit "rough around the edges"; the overall concept and approach > are what's important to me. > > -Ben-------------- next part -------------- #!/bin/bash # 2015-11-02 add -u to sa-learn; change delete to doveadm expunge # 2015-07-21 update executable paths and dbpath # vmail home is organized like: /home/vmail/domains/example.com/bob/Maildir MAILDIR=Maildir SPAMDIR="SystemFolders.Spam" HAMDIR="SystemFolders.Ham" VMAILHOME=/home/vmail VMAILUSER=vmail LS=/usr/bin/ls RM=/usr/bin/rm SU=/usr/bin/su FIND=/usr/bin/find DOVEADM=/usr/bin/doveadm SALEARN=/usr/bin/sa-learn for domain in `$LS "$VMAILHOME/domains"`; do for user in `$LS $VMAILHOME/domains/$domain`; do if [ "$user" = "public_html" ]; then continue; fi dbpath="$VMAILHOME/domains/$domain/$user/.spamassassin" [ ! -d "$dbpath" ] && continue prefs="$VMAILHOME/domains/$domain/$user/.spamassassin/user_prefs" [ ! -f "$prefs" ] && continue echo "$user@$domain" #echo "$user@$domain user_prefs=$prefs dbpath=$dbpath" spamdir="$VMAILHOME/domains/$domain/$user/$MAILDIR/.$SPAMDIR" hamdir="$VMAILHOME/domains/$domain/$user/$MAILDIR/.$HAMDIR" saparm='' if [ -d "$spamdir/new" ]; then saparm="$saparm --spam $spamdir/new " fi if [ -d "$spamdir/cur" ]; then saparm="$saparm --spam $spamdir/cur " fi if [ -d "$hamdir/new" ]; then saparm="$saparm --ham $hamdir/new " fi if [ -d "$hamdir/cur" ]; then saparm="$saparm --ham $hamdir/cur " fi #echo $saparm if [ x"$saparm" != x ]; then # $SU -c "$SALEARN --dbpath=$dbpath --prefspath=$prefs $saparm" $VMAILUSER # $SALEARN --dbpath=$dbpath --prefspath=$prefs $saparm $SALEARN -u "$VMAILUSER" --dbpath "$dbpath" -p "$prefs" $saparm fi # delete using find # [ -d "$spamdir/new" ] && $FIND "$spamdir/new" -type f -delete # [ -d "$spamdir/cur" ] && $FIND "$spamdir/cur" -type f -delete # [ -d "$hamdir/new" ] && $FIND "$hamdir/new" -type f -delete # [ -d "$hamdir/cur" ] && $FIND "$hamdir/cur" -type f -delete # next two lines are for testing: # $DOVEADM -f table fetch -u "$user@$domain" 'date.received' mailbox "$SPAMDIR" # $DOVEADM -f table fetch -u "$user@$domain" 'date.received' mailbox "$HAMDIR" # delete using dovecot $DOVEADM expunge -u "$user@$domain" all mailbox "$SPAMDIR" $DOVEADM expunge -u "$user@$domain" all mailbox "$HAMDIR" done done
Seemingly Similar Threads
- How does one mark all messages as read (imap4flag "seen") with sieve?
- How does one mark all messages as read (imap4flag "seen") with sieve?
- How does one mark all messages as read (imap4flag "seen") with sieve?
- How does one mark all messages as read (imap4flag "seen") with sieve?
- How does one mark all messages as read (imap4flag "seen") with sieve?