1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice

filter e-mail (procmail or something like that)

Discussion in 'Plesk for Linux - 8.x and Older' started by HopChop, Oct 10, 2005.

  1. HopChop

    HopChop Guest


    I've searched the forum and it seems like many have asked the question but the answers are few.

    We have an SMTP-GW in front of our plesk server wich do antivirus and spam filtering. This works just fine so we don't want to run SA and A/V on the plesk server. The problem comes when the users shall filter out the spam.

    Our SPAM-GW adds X-spam-level: **** where the amount of * depends on the score SA gives the mail. This is nice because people can choose to filter the spam on different levels. In our present environment the do this via procmail, but how can we do this in our plesk environment? In horde and squirrelmail you can enable filters, but I guess this only applies when you use the webmail and not when you use IMAP. Is there any way to filter the mails serverwide so that it doesn't matter if you use IMAP, webmail or redirect them to another address?
  2. independis

    independis Guest

    redirect spam


    I did some tests with a modified /var/qmail/mailnames/domain.tld/recipient/.qmail file:

    | if [ -z "$SA" ]; then export SA=1; /usr/local/psa/bin/psa-spamc -f -u mail@domain.tld -U /tmp/spamd_full.sock > spamcheck$$; if [ "`sed -n -e '1,/^$/ s/^X-Spam-Status: \(Yes\).*$/\1/p; /^$/ q' spamcheck$$`" != "Yes" ]; then /var/qmail/bin/qmail-local "$USER" "$HOME" "$LOCAL" "" "" "$HOST" "$SENDER" "$DEFAULT" < spamcheck$$; retval=$?;
    else /var/qmail/bin/qmail-inject spam@domain.tld < spamcheck$$; retval=$?; fi; rm -f spamcheck$$; [ $retval = 0 ] && exit 99; fi # FORWARD UCE
    | true

    The only problem is I don't know yet when .qmail will be overwritten by plesk.


  3. HopChop

    HopChop Guest

    I looked a little om writing a .qmail, but the code is not that easy to understand. Is there a good guide for how to write dot-mail files? When I googled for dot-qmail or .qmail I got many hits, but most of them were how tos for external filters and how these could be called from dot-qmail.
  4. ShadowMan@

    ShadowMan@ Guest

    Do not be intimidated by what independis posted
    This is just a bunch of script commands put onto a single line.
  5. independis

    independis Guest

    It was not my intention to confuse anybody... ;-)

    My .qmail script is only a modification of the original plesk-generated script for deleting spam.

    Instead of ignoring the spam mail (and delete it) I forward it to a new mail address - that's all. I don't know more about how to write .qmail scripts, I only changed a few things which seemed logically to me.

    In my opinion, the plesk people could implement such a forwarding option very easily into plesk to make it more usable.

    I appreciate any comment or improvement.

  6. HopChop

    HopChop Guest

    Oh, I wasn't intimidated by independis qmail. I recognise some parts of it. The problem is that I don't want to call Spamc or any other external filter at all. All I want is to filter on things like parts of the subject, different senders or maybe parts of the header. All these things are easy to do with procmail and shall be possible to do with dot-qmail. The problem is that I don't figure out how, and that all documentation regarding Qmail in general are really hard to understand.