Filtering SPAM

Discussion in 'Installation/Configuration' started by MvincM, Jun 15, 2006.

  1. MvincM

    MvincM New Member


    I have some problem. My client has a lot of spam (a lot !). Filter works great. All bad mails are marked as **SPAM**. But he doesn't want to recive them to local Otulook. Ofcourse he can change to delete them bu it is dangerous (good mail could be delete). So the idea is to filter all **SPAM** marked mails to special foler (in home maildir folder) e.g. "Spam mails". So once a time he could chceck via WebMail what is in spam folder and delete spam mails or not.

    And the question is how to do this? If it could be set globaly it could be great but if it not possible I can set it for all mails account (a lot of work ;))) )

    Please advise.

    Thanks in advanced.

    Best regards,
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    You can change the spamfilter procmail recipe to redirect spam emails to a directory.

    The master template for all spamfilter procmail recipes is:


    The procmail recipes in the user directories where rebuild from the mster template when you change a useraccount or create a new one.
  3. badben

    badben New Member

    Why don't they just set up a rule in outlook so that all mails with ***SPAM*** in the subject get moved to a spam folder.

    That is of course if they use microsoft outlook or express but I assume other programs have similar functions as well.
  4. MvincM

    MvincM New Member


    Just three more questions ;) :

    1) Is /root/ispconfig/isp/conf/spamassassin.rc.master upgraded on new ISP version instalation?

    2) Is .spamassassin.rc (in user dir) update to new one version for all user? If I have new /root/ispconfig/isp/conf/spamassassin.rc.master (with my mods) is only thing to do is to add/delete any new user?

    3) And the last one. My mods to /root/ispconfig/isp/conf/spamassassin.rc.master is:

    * ^X-Spam-Status: Yes

    Is it all? Where good mails are going in this situation?

    Last edited: Jun 15, 2006
  5. MvincM

    MvincM New Member


    They do not want ;)) to recive those mails and to sort in OL.

    They use a lot of GPRS connections and all KB costs (money and time).

  6. till

    till Super Moderator Staff Member ISPConfig Developer

    No, only if you change the user as i described in the last post.

    This shall be fine

    Good mails will pass this filter.
  7. MvincM

    MvincM New Member

    Thanks a lot ! All clear.

  8. MvincM

    MvincM New Member

    One more thing ;)

    Are there any "skel" folder for new users (like in normal user adding proccess).

    I would like to automaticly add SpamMails folder and "courierimapsubscribed" file (to bookmark SpamMails folder automaticly in WebMail).

    Thanks in advanced.

  9. falko

    falko Super Moderator Howtoforge Staff

  10. farao

    farao New Member

    Sorry to bump such an old thread, but for some reason spamassassin won't put spam-tagged messages in a Maildir/.Junk folder. Below is the code from .spamassassin.rc.

    * ^X-Spam-Status: Yes
    The .Junk-folder exists, is readable in IMAP-clients, but spam just won't show up. I sent myself the GTUBE test mail, and it just disappears. If I put a # in front of the folder-line, the correctly tagged spam does land in my regular inbox.

    I also noticed that for my users, the home-folder is /var/www/webX, without the added user/webX_userY. Everything else works, so I'm guessing it must be something with the code in my .spamassassin.rc.

    Thanks for any help.
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    And the .spamassassin.rc file is in the home directory of the user?
  12. farao

    farao New Member

    Actually, no...

    The home directory (perfect setup, install of ISPC on Ubuntu 6.06) is determined as /var/www/web3, with a symlink Maildir to /var/www/web3/user/USERNAME/Maildir.
    The .spamassassin.rc is in the user-directory: /var/www/web3/user/USERNAME/.spamassassin.rc

    Everything is where the default install puts it...
    So I guess the directory in the spamassassin recipe should be something like: $HOME/user/$username/Maildir/.Junk
    The .Junk folder is a real folder, not a file...

    If so, why is the $HOME not the username-directory? By the way, this particular user is the administrator for the web in question, I'm not sure what other users have as their home-dir...

    My guess is that the $HOME/Maildir/.Junk would work for regular users, and that only the admins need some tweaking?

    So should I hardcode the absolute path in every administrators spam-recipe?
  13. falko

    falko Super Moderator Howtoforge Staff

    That's ok because .procmailrc is in /var/www/web3, and it calls the SpamAssassin recipe.

    For the site admin the homedir is /var/www/web3, for normal users it's /var/www/web3/user/USERNAME.
  14. punto

    punto New Member

    Hi I am also trying to filter any messages marked as ''SPAM" to a separate folder for one client. This client has 8 mailboxes and any SPAM that is detected they want moved to a separate folder that they can check once a week (via webmail) to make sure no legitimate mail is being moved. They dont want to filter it with Outlook, they want a rule server side.

    I am a wee bit confused as to how to set this up. I can follow the logic of the thread but is that for one user only? I want to apply it to the whole domain if possible?
    My build is Centos 4.4, webs are located at /var/www/
    mail directorys are at /var/mail (not using maildir).

    I made the changes to
    /var/www/ directing the SPAM mail to /var/mail/ with the following:

    * ^X-Spam-Status: Yes

    I then created a new SPAM user, that created a mailbox under /var/mail/SPAM_mailbox, but this didnt work, SPAM sent to the user still went to his inbox and not the new mailbox.

    Obviously this isnt a folder but a file, if I send it to a folder and dont create a new user how do you read the mail?

    Any help appreciated. :)


  15. Rocky

    Rocky Member

    I think you would have to be using Maildir for this to work.
  16. punto

    punto New Member

    Thanks for the reply Rocky,

    Do you know if I can change over to maildir now (under server management, ISP Server settings) without any issues?

    Thanks in advance

  17. Rocky

    Rocky Member

    You wouldn't be able to change over to Maildir without first converting your mailbox, which i beleive is in mbox format, to Maildir format by using mb2md.

    If you enable Maildir now, you'll probably stop receiving mails to you mailboxes.

    I did the following on my Mandriva 2006 Perfect Setup to enable Maildir:

    Downloaded mb2md and placed it in the /usr/bin directory. I then ran the following command:

    I was logged in as root.

    sudo -u john -s /var/mail/john -d /var/www/web3/user/john/Maildir

    After the command ran, it created 3 additional folders under /var/www/web3/user/john/Maildir:

    Those are Maildir folders.

    After that, I uninstalled my mbox ready pop daemon and installed courier-imap-pop, which supports Maildir. I then went into ISPConfig and enabled Maildir. I restarted Postfix and everything worked.

    If you're going to try this, you don't have to convert the following accounts:
  18. punto

    punto New Member

    Thanks for the how-to Rocky, appreciate it.

    Anyone know if there are other ways to filter SPAM at the server without changing over to Maildir?


  19. falko

    falko Super Moderator Howtoforge Staff

    There's no way doing it with mbox because with mbox all emails are stored in one single file.
  20. punto

    punto New Member

    OK thanks Falko, looks like I will need to migrate to Maildir.

    Appreciate the feedback.


Share This Page