Spam -> Move to Junk

Discussion in 'Tips/Tricks/Mods' started by ZeroEnna, May 12, 2016.

  1. ZeroEnna

    ZeroEnna Member

    Hello board,

    I tried to do exactly that: Mails with X-Spam-Flag = YES should automatically move to Junk folder.
    I created a file /etc/dovecot/sieve/spam-to-folder.sieve with this content:

    require "fileinto";
    if header :contains "X-Spam-Flag" "YES" {
    fileinto "INBOX.Junk";
    }​

    and added it via sievec, then restarted dovecot. However, Spam mails are still stored in the inbox, instead of the junk folder.

    Any ideas?

    Regards
    Zero

     
  2. Jesse Norell

    Jesse Norell Active Member

    You might try just "Junk" for the folder name (that's what the
    'Move Spam Emails to Junk directory.' mailbox setting uses), and test adding a stop; after fileinto (maybe a later sieve script is simply moving it back to INBOX?)

    If still not working, make sure you have sieve_global_dir set in your dovecot config, and check the sieve log file to see if it indicates anything (I'm not sure where that'd be for a global script, just the user sieve log file, or maybe /var/log/mail.log ?).
     
  3. sjau

    sjau Local Meanie Moderator

    if you're using ISPConfig, you can setup sieve rules directly there.

    In the mailfilter tab of your account there's even a checkbox for: "Move Spam Emails to Junk directory."
     
  4. ZeroEnna

    ZeroEnna Member

    Seriously? Can I be that blind? Can it really be that simple? Gnahhhh :( Thank you, I was so dumb.
     
  5. sjau

    sjau Local Meanie Moderator

    well, doing it directly with sieve config files also works... and you learn a lot more by doing it that way ;)
     
  6. Jesse Norell

    Jesse Norell Active Member

    Or if you want global scripts that affect everyone, creating your own is the only way.
     

Share This Page