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
LVL 1
jmarkfoleyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

arnoldCommented:
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
0
kenfcampCommented:
Add the following three lines to your ".procmailrc" file:

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

Replace "USERNAME" with your username

These three lines should be placed immediately following the "/usr/local/bin/spamc"
 (or /usr/local/bin/spamassassin - if you're not running spamd) line in the ".procmailrc" file.

This should invoke the vacation program only for email which is not flagged as spam by Spamassassin.

Hope this helps

Ken
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JohnBusiness Consultant (Owner)Commented:
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.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

jmarkfoleyAuthor Commented:
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
0
JohnBusiness Consultant (Owner)Commented:
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.
0
kenfcampCommented:
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
0
arnoldCommented:
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
}
0
jmarkfoleyAuthor Commented:
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!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.