Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How can I set up a site-wide rule to deliver all messages marked as Spam to the user's .Junk folder? And if the folder doesn't exist, create it. I know I can make a .forward file in the user's home directory, but I'm hoping there's a better way to do this. Thanks.

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

I don't think exim would be the tool to do this, more likely the MDA (Mail Delivery Agent) on your system is responsible for this kind of filtering. Exim has some delivery functions, but usually it is used as an MTA (Mail Transfer Agent) and passes mail off to another program for deliver. Sometimes this is procmail or maildrop. Those programs have config files that filter mail based on headers and change their delivery decisions based on them.

share|improve this answer
add comment

Exim usually will act as and MDA, although it will use maildrop or procmail if they are available.

If Exim is your MDA, you can setup a special router and transport that filters by spam score. This is the easiest way to add this action as the default. Base the router on the local_delivery router (likely the last router), and place it right before the local_delivery router. Base the transport on the transport used by the local_delivery router but change the destination to the Junk mailbox (directory or file).

I prefer procmail when I want to filter email into different mailboxes. You would filter the headers for the Spam header, and write to the appropriate mailbox.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.