Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I host my own mail server using Postfix and Dovecot on a virtual ubuntu server. In order to keep on top of my inbox, I use Popfile on the server to sort emails into categorized folders in my IMAP mailbox.

Now I want to forward all email that Popfile puts into that specific folder to somebody else. As far as I unterstand it, a filtering framework such as Sieve evaluates the processing rules only on delivery.

Is it possible to somehow make the server watch a folder for emails to refilter? Or is there another elegant approach to solve my problem that I have not considered yet?

share|improve this question

1 Answer 1

up vote 1 down vote accepted
+50

While it is possible to do this unnatural thing you are asking for (i.e. rerunning dovecot local delivery on messages in a Maildir folder to force reprocessing of those messages by Sieve), the "elegant approach" would be getting rid of Popfile altogether and replacing it with spamassassin for spam detection and Sieve scripts for the rest of your sorting rules.

If you insist on redelivering a message the command is:

/usr/lib/dovecot/deliver -d <mailbox_name> -p <path_to_the_message_file>

to redeliver all messages in IMAP folder "Filtered" of user "john":

find /home/john/Maildir/.Filtered/cur/ -type f -exec /usr/lib/dovecot/deliver -d john -p {} \;
share|improve this answer
    
I am aware of this possibility. However, I use Popfile because it can categorize my non-spam email using bayesian filtering. This is its killer feature and the reason why I use it over spamassassin or some other spam-specific filtering solution. Correct me if I'm wrong, but as far as I know spamassassin cannot do this type of categorization at all. –  Jannik Jochem Jan 25 '13 at 12:20
    
Can you give an example of such non-spam message and how you would like it to be sorted? From my experience most non-spam correspondence has enough legitimate information like sender's address, etc. not to have to resort to using Bayes for filtering. –  Alex P. Jan 25 '13 at 18:04
    
For example, I have a folder for all kinds of newsletters that are sent by different organizations. If I was going to use filtering rules for this, I'd have to spell out the sender address / domain for each of these organizations. I have a "work" folder for work-related stuff for which the same goes. Then I have another folder for personal correspondence. How would you go about defining a rule for that? –  Jannik Jochem Jan 25 '13 at 21:04
1  
Since you are hosting your own mail server I am assuming you have your own domain name. In this case you should use different mailboxes for different purposes. You can set them up as aliases and still have just one physical mailbox for convenience. Then you would be able to use "X-Original-To" header for filtering. Also do not be afraid of having to create the rules for your existing subscriptions. It is easy to automate. Parse the messages you have already sorted - save all unique sender addresses in "work" folder to a file and then use it as a lookup table for the "work" filter rule. –  Alex P. Jan 25 '13 at 21:48
    
Well this all ends up costing lots of time to set up, while the Popfile approach works pretty nicely for me right now. Thank you for your suggestions, I think I will give them a try sometime. This makes sense since Popfile does not seem to get a lot of updates as of late. However, this does not solve the task I am trying to accomplish right now. –  Jannik Jochem Jan 25 '13 at 22:09

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.