Link to home
Start Free TrialLog in
Avatar of Mark
Mark

asked on

How to not reply to spam when using vacation (Linux)

I am using the vacation utility on linux, Slackware64 14.1. When running, the $HOME/.vacation file has:

\\myuserId, "|/usr/bin/vacation myuserId"

$HOME/.procmailrc has:

DEFAULT=/home/HPRS/myuserId/Maildir/

This all works fine except that spam messages get responded to by vacation. How can I not have vacation sent out-of-office notices to spam? Note that spam will always have "[SPAM]" in the subject line, e.g.:

Subject: 4.4 [SPAM] Buy now and save
Avatar of arnold
arnold
Flag of United States of America image

You should not use the vacation command, but use a vacation recipe for procmail.  Only respond to emails after the pass all your procmail filtering/spam recipes
Man procmailrc
Man procmailex

Have you looked at integrating a Bayesian filter in Slackware, a good one that can be integrated into procmail if spamassassin is not in play is bogofilter from sourceforge.


You van set a variable to indicate that vacation is enabled and then include a test for vacation being active which will be before the first delivery that is not to a spam folder using the


:0c
* $ vacation test if vacation is enable.  Not correct syntax. You can do variable comaorison
|vacation if you must...... Use the vacation binary

:
$DEFAULT
ASKER CERTIFIED SOLUTION
Avatar of kenfcamp
kenfcamp
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Either that, or (in my opinion more preferably) have front end spam control that never allow spam to get to your machine. That is what I do.
Avatar of Mark
Mark

ASKER

Thanks for the replies. More information: I am running spamassassin server-wide as a milter on sendmail, not at the user level. Yes, I am using the Bayes filter. I an also running spamass-milter which will reject spam above a certain threshold and that mail never gets delivered to the user (John Hurst). Mail that scores below the rejection score, but above the SPAM threshold will be marked as spam and delivered to the user's Junk Mail folder for their review in case of false positives.

So, given that, should I not use the .forward file (as Arnold suggested) and have my .procmailrc as follows per kenfcamp's suggestion:
DEFAULT=/home/HPRS/USERNAME/Maildir/

:0c:
* !^X-Spam-Status: YES
|/usr/bin/vacation USERNAME

Open in new window


Is that right? With the rule after the DEFAULT? I suppose I could even have:

* !^Subject: .*\[SPAM\]
|/usr/bin/vacation USERNAME
I have Spamassassin on my own email ISP and it removes 98 percent of spam or more. Some will always get through, so then it will go back out with the vacation rule.
I wouldn't use .foward. As far as using .procmailrc try it and see if it works for you

The real problem here is as John mentioned. While you can block a very large amount of spam from getting through, some will still get through just the same.

This means that by using the vacation script, you'll be sending spam by replying to the spam and this could have a negative impact by causing your email and/or IP address to get black listed

If your list of people who you want to be contacted in the event your out of the office is short you can try the following.

Put the email address in a file called .vacation.list
user1@somemail.com
user2@someotheremail.com
etc

Then add this to your .procmailrc file

:0c
* ? formail -x"From" -x"From:" -x"Sender:" \
    | egrep -is -f .vacation.list
{
:0
| /usr/bin/vacation -r 1 -a "email-useralias-used" "username"
}  

This will check the email sender against the list. If the sender is in the list, then it will activate the vacation script. Otherwise, the message will be delivered normally w/ no notification.

Ken
the :0c (no need to use the : for locking) should precede the final delivery, if it follows,  the vacation recipe will never be tested as the message has been disposed/delivered.

IMHO, it might be better to use the example within procmailex man pages for vacation

The notification should always check whether your email address,addresses are in the To or the Cc: header deals with emails that you might be forwarding i.e. using forwarding email address.
listofemails='emailaddress1|emailaddress2|emailaddress3|emailaddress3'
#will use you lock
:0c:
* ! ^Subject:.*\[SPAM\]
*^(To|Cc):.*($listofemails)
|/usr/bin/vacation $USERNAME

:0
$DEFAULT


One option depending on whether you want to go through modifying the files to activate/deactivate versus setting up the config file/s and then use a config file where variables are set to activate the different componens

:0
* $VACATION ? [oO][nN]
{
# block of stuff to do
}
Avatar of Mark

ASKER

Tested stuff and here's what I end up with, it works:

$HOME/.procmailrc
DEFAULT=/home/HPRS/myuserid/Maildir/

:0c
* !^Subject: .*\[SPAM\]
|/usr/bin/vacation myuserid

Open in new window

kenfcamp: This is for an office so no, we really don't have a list of specific people to send the vacation reply to.

I no longer need the .forward

This .procmailrc ends up being generated by a mail shell-script when a user sends a message to away@mydomain.com. Another script turns off vacation when a message is sent to away@mydomain.com with "stop" in the subject. We use this mechanism because we have an IMAP server and without Exchange, Outlook has issues with implementing out of office.

Everything seems to work just fine now -- no reply to spammers!