Find the answer to your Linux question:
Results 1 to 4 of 4
Hi there, I am new here and yes I have asked google and searched the forum before posting. As a script newbie my question might still sound dumb: I put ...
  1. #1
    Just Joined!
    Join Date
    Sep 2008
    Posts
    3

    spamassassin learn and dump script

    Hi there,

    I am new here and yes I have asked google and searched the forum before posting. As a script newbie my question might still sound dumb:

    I put SPAM mail into my junk folder, I would like to run a cron every now and then to train Spamassassin

    I use a little script something like:

    #! /bin/bash

    sa-learn --spam /var/qmail/mailnames/mydomain.de/tester/Maildir/.Junk/*

    rm /var/qmail/mailnames/mydomain.de/tester/Maildir/.Junk/cur/*

    the second line should discard the junk folder after the training.
    it works but my question is, will this command keep the imap directory structure ok? is there a nicer or better way to discard the emails from the .Junk folder. I am running it on a test account (tester) and want to make sure before using ist on my actual account

    I would be grateful for any hint

    regards marty

  2. #2
    Linux User
    Join Date
    May 2008
    Location
    NYC, moved from KS & MO
    Posts
    251
    Sounds like you are using maildir format. According to MailboxFormat/Maildir - Dovecot Wiki , an example of the email filename might be time_info_in_numbers.hostname.other_info. Just pay attention to the bold part in the file name, you can use command find to search for emails only.

    find /var/qmail/mailnames/mydomain.de/tester/Maildir/.Junk/cur/ -name "*your_email_hostname*" -type f -exec echo rm -f {} \;

    Plug in the email server's hostname and run the command, if it shows the right right files, remove "echo" and run the command again.

  3. #3
    Just Joined!
    Join Date
    Sep 2008
    Posts
    3

    thanks for the hint

    Hi,
    thanks for the hint. I will try it and let You know how it worked.

    regards

    Martin

  4. #4
    Just Joined!
    Join Date
    Sep 2008
    Posts
    3
    Hi again, works fine, thanks!
    Only Problem I figured was when I setup a cron via Plesk it says "permission denied" when I try to run it (the rm command)
    So I put the cron directly into the root etc/cron.daily
    I hope that is ok !?

    regards

    marty

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...