2

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.

ensnare
  • 2,212
  • 7
  • 24
  • 40

2 Answers2

1

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.

Caleb
  • 11,813
  • 4
  • 36
  • 49
1

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.

BillThor
  • 27,737
  • 3
  • 37
  • 69