The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Any way to process lots of messages in webmail with SpamAssassin?

Discussion in 'E-mail Discussions' started by Kent Brockman, Dec 11, 2014.

  1. Kent Brockman

    Kent Brockman Well-Known Member

    Joined:
    Jan 20, 2008
    Messages:
    1,130
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Buenos Aires, Argentina
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hi! I searched the forums but I had no luck on this one.

    I adquired a couple vps where SpamAssassin wasn't auto-deleting spam. So, webmail folders are crowded with spam.

    Is there any command line or script to run and make SpamAssassin scan those particular mail accounts to auto-delete its contained spam?

    Thanks in advance!
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,724
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    It won't scan messages that have already been delivered, but you could develop a bash script that searches for specific content within an email and removes any messages that match the search term.

    Thank you.
     
  3. Kent Brockman

    Kent Brockman Well-Known Member

    Joined:
    Jan 20, 2008
    Messages:
    1,130
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Buenos Aires, Argentina
    cPanel Access Level:
    Root Administrator
    Twitter:
    ok, that's bad news. well, thanks, I had the hope to automagically been able to run some bash script that make SA scan a delete all those msgs with certain score.

    Maybe a find command with awk to detect the string "Score: " and evaluate the value and act accordingly?
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,724
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Yes, this is one option that you may find helpful. Note that you likely want to move the messages to another location for a set time period before removing them in-case customers complain of the removal of legitimate email.

    Thank you.
     
  5. Kent Brockman

    Kent Brockman Well-Known Member

    Joined:
    Jan 20, 2008
    Messages:
    1,130
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Buenos Aires, Argentina
    cPanel Access Level:
    Root Administrator
    Twitter:
    I know, I should try piping results to dir command rather than rm until I got it perfectly ok :) And then, I should move the message files to the spam folder.

    I think I need some senior help here. I built the command to read the Scores, but I don't know how to eval them if the value is, let's say, bigger than 5 (for X-Spam-Score: 5 and upper).

    Code:
    grep -nr "X-Spam-Score: " /home/accountname/mail/.email@domain_com/new | cut -d':' -f4
    Not sure how to evaluate values from the command line. Is it possible?
     
Loading...

Share This Page