• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

filter e-mail (procmail or something like that)

H

HopChop

Guest
Hello!

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?
 
redirect spam

Hi,

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 [email protected] -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 [email protected] < spamcheck$$; retval=$?; fi; rm -f spamcheck$$; [ $retval = 0 ] && exit 99; fi # FORWARD UCE
| true
./Maildir/

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

Regards,

Ralf
 
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.
 
Originally posted by HopChop
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.
Do not be intimidated by what independis posted
| if [ -z "$SA" ]; then export SA=1; /usr/local/psa/bin/psa-spamc -f -u [email protected] -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 [email protected] < spamcheck$$; retval=$?; fi; rm -f spamcheck$$; [ $retval = 0 ] && exit 99; fi
This is just a bunch of script commands put onto a single line.
 
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.

Ralf
 
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.
 
Back
Top