Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I would like to know if its possible to archive specific emails based on the /Subject:/ for example if I receive an email with "Website Support" it will archive it in "Support".. is this possible?

share|improve this question

2 Answers 2

Use procmail for this. Your /etc/postfix/main.cf should have the line:

mailbox_command = procmail -a "$EXTENSION"

to enable procmail

You can then use rules like:

MAILDIR=$HOME/Maildir

:0
* ^Subject:.*\[zeromq-dev\]
$MAILDIR/.Mailing.zeromq/

in your ~/.procmailrc to have all items with [zeromq-dev] in the subject got to the zeromq subfolder under Mailing where your IMAP server, will find it.

share|improve this answer

Postfix is SMTP daemon. You should do this on MDA or on IMAP server. For MDA you could use sieve scripts (dovecot MDA supports sieve). For IMAP itself, you could use imap-filter (lua). Usually we don't have access to things like procmail/maildrop on remote mail servers. Some webmails' filtering also fancy filter rules as well.

share|improve this answer
    
I do have dovecot installed with postfix.. how do I do this ? –  XK8ER Oct 31 '13 at 11:00
    
It depends what you want. The idea behind my answer was that "modern" style of filtering mail is sieve (see en.wikipedia.org/wiki/Sieve_%28mail_filtering_language%29). There are various tools which support sieve. One of them is Dovecot MDA. Benefit is that you can modify sieve filters remotely via mail clients or specialized tools (ManageSieve protocol). You didn't describe what is your mail storage. Is it traditional mbox, maildir; do you have IMAP server installed? I won't use procmail as I like client-server design of ManageSieve protocol and I don't need ssh to edit procmail rules. –  Jiri Xichtkniha Oct 31 '13 at 12:29

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.