Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Support
  3. Can't discard spam messages on arrival using Sieve filters

Can't discard spam messages on arrival using Sieve filters

Scheduled Pinned Locked Moved Solved Support
sieve
28 Posts 5 Posters 5.2k Views 5 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • girishG girish

    @d19dotca Just got around to looking into this. This doesn't work because the mail server processes spam messages using dovecot's sieve_before flag - https://doc.dovecot.org/settings/pigeonhole/#plugin-sieve-setting-sieve-before . You can check the /app/dovecot-config/sieve_before/spam-move.sieve script in the mail container which is moving X-Spam-Flag into the Spam folder. Because the filter below is run before user messages, your filters don't work. This also makes it easy for the end user to not worry about processing spam messages when writing filters, so I think the default behavior is good.

    require ["fileinto","mailbox"];
    
    if header :contains "X-Spam-Flag" "YES" {
        fileinto "Spam";
        stop;
    }
    

    For the original use case of discarding all spam for forwarding mailboxes, this is the default behavior in next release.

    C Offline
    C Offline
    ccfu
    wrote on last edited by ccfu
    #19

    @girish said in Can't discard spam messages on arrival using Sieve filters:

    so I think the default behavior is good.

    As a default I think so too, but whilst the spam protection in Cloudron is reliable, sometimes the end user wants / needs to be able to filter spam messages directly 😉 It would therefore be good to have a simple way of filtering mails to discard spam selectively rather than just having all SPAM go to the SPAM folder. Mails with a SPAMASSASSIN score of over 20, for example, do not need to be saved anywhere, but those with a score of 7 or 8 could in theory be false positives so would warrant 'quarantining' rather than discarding altogether. The same applies to certain sender addresses and subjects.

    This does not need to be something defined in webmail clients per domain, but could be a server-wide setting similar to the custom spamassassin rules.

    girishG 1 Reply Last reply
    2
    • C ccfu

      @girish said in Can't discard spam messages on arrival using Sieve filters:

      so I think the default behavior is good.

      As a default I think so too, but whilst the spam protection in Cloudron is reliable, sometimes the end user wants / needs to be able to filter spam messages directly 😉 It would therefore be good to have a simple way of filtering mails to discard spam selectively rather than just having all SPAM go to the SPAM folder. Mails with a SPAMASSASSIN score of over 20, for example, do not need to be saved anywhere, but those with a score of 7 or 8 could in theory be false positives so would warrant 'quarantining' rather than discarding altogether. The same applies to certain sender addresses and subjects.

      This does not need to be something defined in webmail clients per domain, but could be a server-wide setting similar to the custom spamassassin rules.

      girishG Offline
      girishG Offline
      girish
      Staff
      wrote on last edited by
      #20

      @ccfu yes, I can look into adding customization for spam handling in the coming releases. I have also wanted a user editable whitelist/blacklist for spam (instead of having to rely on admin).

      C ? 2 Replies Last reply
      5
      • girishG girish

        @ccfu yes, I can look into adding customization for spam handling in the coming releases. I have also wanted a user editable whitelist/blacklist for spam (instead of having to rely on admin).

        C Offline
        C Offline
        ccfu
        wrote on last edited by
        #21

        @girish

        Sounds good 🙂

        1 Reply Last reply
        1
        • girishG girish

          @ccfu yes, I can look into adding customization for spam handling in the coming releases. I have also wanted a user editable whitelist/blacklist for spam (instead of having to rely on admin).

          ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #22

          @girish would it be per-user or per-inbox? I ask since we can have groups using a specific email.

          girishG 1 Reply Last reply
          0
          • ? A Former User

            @girish would it be per-user or per-inbox? I ask since we can have groups using a specific email.

            girishG Offline
            girishG Offline
            girish
            Staff
            wrote on last edited by
            #23

            @atrilahiji I guess it will have to be per-inbox.

            1 Reply Last reply
            1
            • girishG girish

              @d19dotca Just got around to looking into this. This doesn't work because the mail server processes spam messages using dovecot's sieve_before flag - https://doc.dovecot.org/settings/pigeonhole/#plugin-sieve-setting-sieve-before . You can check the /app/dovecot-config/sieve_before/spam-move.sieve script in the mail container which is moving X-Spam-Flag into the Spam folder. Because the filter below is run before user messages, your filters don't work. This also makes it easy for the end user to not worry about processing spam messages when writing filters, so I think the default behavior is good.

              require ["fileinto","mailbox"];
              
              if header :contains "X-Spam-Flag" "YES" {
                  fileinto "Spam";
                  stop;
              }
              

              For the original use case of discarding all spam for forwarding mailboxes, this is the default behavior in next release.

              d19dotcaD Offline
              d19dotcaD Offline
              d19dotca
              wrote on last edited by
              #24

              @girish said in Can't discard spam messages on arrival using Sieve filters:

              For the original use case of discarding all spam for forwarding mailboxes, this is the default behavior in next release.

              Do you mind just expanding on this a bit more? What is a "forwarding mailbox" in your terms? Are you referring to the other feature request I had about mailing lists having an option to not forward messages identified as spam? If so, that's great! But now I will have to go back to the mailing list functionality I had moved away from a couple weeks ago, haha, but that's all good. If I've misunderstood what you mean by "forwarding mailbox" though, please clarify.

              --
              Dustin Dauncey
              www.d19.ca

              girishG 1 Reply Last reply
              0
              • d19dotcaD d19dotca

                @girish said in Can't discard spam messages on arrival using Sieve filters:

                For the original use case of discarding all spam for forwarding mailboxes, this is the default behavior in next release.

                Do you mind just expanding on this a bit more? What is a "forwarding mailbox" in your terms? Are you referring to the other feature request I had about mailing lists having an option to not forward messages identified as spam? If so, that's great! But now I will have to go back to the mailing list functionality I had moved away from a couple weeks ago, haha, but that's all good. If I've misunderstood what you mean by "forwarding mailbox" though, please clarify.

                girishG Offline
                girishG Offline
                girish
                Staff
                wrote on last edited by
                #25

                @d19dotca sorry, i meant mailing list and not forwarding mailbox!

                1 Reply Last reply
                0
                • C Offline
                  C Offline
                  ccfu
                  wrote on last edited by
                  #26

                  Any update on this? Ideally it would be nice to be able to define a custom spam assassin rule to instantly discard mails with certain criteria. I see persistent SPAM in the event log with easily identifiable criteria I would like to discard before it hits a mailbox but at the moment all I can do is give it a score of 100 so it is always marked as SPAM.

                  Whilst we can prevent mailservers with specific IPs or ranges from delivering mails via the firwall, this does not work for hostnames. That would be another way of stopping persistent spamming domains.

                  1 Reply Last reply
                  1
                  • girishG Offline
                    girishG Offline
                    girish
                    Staff
                    wrote on last edited by
                    #27

                    @ccfu We have to implement this feature to discard things . Can you raise a feature request there to discuss / with your use case ?

                    C 1 Reply Last reply
                    0
                    • girishG girish marked this topic as a question on
                    • girishG girish has marked this topic as solved on
                    • girishG girish

                      @ccfu We have to implement this feature to discard things . Can you raise a feature request there to discuss / with your use case ?

                      C Offline
                      C Offline
                      ccfu
                      wrote on last edited by
                      #28

                      @girish Done: https://forum.cloudron.io/post/89451

                      1 Reply Last reply
                      1
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Bookmarks
                      • Search