Help with Exim filter

I'm attempting to set up a system filter for exim4 which will act based upon spamassassin's score. Here is the gist of my filter:

# Exim filter

if (foranyaddress $recipients ($thisaddress contains "@mydomain.co.uk"))
  and $h_X-Spam_score_int: is above 99 
    unseen mail to $thisaddress
    subject "[ SPAM Witheld ] $h_subject:"
    from "postmaster@mydomain.co.uk"
    text "Message scored $h_X-Spam_score_int:"
    seen save /var/mail/spam_hole
finish endif

Open in new window


The above results in the mail being saved to /var/mail/spam_hole successfuly, but a new mail is not generated to the original recipient as intended, and the error Error in system filter: malformed numerical string "" is written to my log.

The offending numerical string is the spam score in the line $h_X-Spam_score_int: is above 99 . I know this because if I change it to 100 is above 99 all is well. What is weird is that the exact same variable is being used in the body of the report message, and at that point is populated with the numerical value you'd expect, so why is it empty at the top of the file??
LVL 1
Joe_PritchardAsked:
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.

gheistCommented:
Last seen must be changed to unseen, as seen makes delivery final.
0
Joe_PritchardAuthor Commented:
Thanks for the comment Gheist. That is what I want though, I'm not looking to deliver the original mail to the end recipient, I'm creating a new message to notify him he's received mail with a very high spam score, and Exim is throwing an error due to the use of the $h_X-Spam_score_int variable when trying to execute the filter.
0
gheistCommented:
exim -v -v -v -v -bf <filter file>
<paste full spam mail here>

Ctrl-D
0
Managing Security & Risk at the Speed of Business

Gartner Research VP, Neil McDonald & AlgoSec CTO, Prof. Avishai Wool, discuss the business-driven approach to automated security policy management, its benefits and how to align security policy management with business processes to address today's security challenges.

Joe_PritchardAuthor Commented:
Cheers Gheist. Due to the time-sensitive nature of this thing I've actually decided to take a different approach and have more or less achieved what I wanted. Basically I have used an ACL in my main configuration to set two $acl_m_ variables (based on the same criteria I was trying to check from within the filter), which I'm now referencing within my filter. This is working well, it just means there are slightly more moving parts to it than the way I was trying.

Still don't know why some variables are not accessible to me in certain places within the filter, but it's a workaround I'm happy enough with.

Thanks for the attention anyway

All the best

Joe

P.S. Oddly enough I couldn't get the filter test you specified to work, it seems to ignore all the header information in the spam message that's piped into it, so the results are not valid as it tries to default to using the current user's address as both the sender and recipient... Isn't email weird?
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
gheistCommented:
Filter test used to work just fine at times.... Weird it does not...
0
Joe_PritchardAuthor Commented:
I used a different method to get the results I wanted - seems a more robust solution anyway. Simply closing the question as I have solved it myself. Perhaps the answer all along was that I was trying to do it the wrong way...
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
Email Servers

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.