procmail
[Top] [All Lists]

Tip: Simultaneously file a message in an IMAP mailbox and assign a Gmail label

2004-07-20 10:57:44
I'm a packrat and I save lots of messages in lots of mailboxes and it's all quite a mess when I want to find an old message. So I've been playing around with a Gmail account and filing important messages there. I also want to put a copy in a regular IMAP mailbox too (which is my old way of doing things). Gmail uses labels to help you categorize messages so my goal was to have an easy way to simultaneously:

* redirect (bounce forward) a message to Gmail and have it labeled
with a label named FOO

* save it in an IMAP mailbox named FOO

Currently at Gmail, you need to create a filter in order to automatically assign a label to an incoming message. Their filters are pretty lame so I'm currently putting the label in the Cc: header (because that is something that the Gmail filter knows how to match on).

Anyway, here's what I'm doing:

1] I use Pine or Mulberry to bounce forward a message to

        nm+FOO(_at_)deflexion(_dot_)com

2] At deflexion.com I have procmail running with this recipe:

:0
* ^Resent-To:.*nm\+\/.*@
* MATCH ?? ()\/[^(_at_)]+
{
        :0 c:
        $MATCH

        :0 fhw
        | formail -A "Cc: gmailID+$MATCH(_at_)bogus"

        :0
        ! gmailID+$MATCH(_at_)gmail(_dot_)com
}


3] At gmail.com I have a filter that looks like this:

    If To gmailID+FOO
     Then assign label FOO and bypass inbox

This gmail filter works for both procmail deflected messages as well as messages that I send directly to gmailID+FOO. Note that in a Gmail filter "To" means "To: or Cc:".


NOTES
* All email addressess above are bogus!
* I've written a bit about Gmail and Procmail here

  <http://www.ii.com/internet/robots/procmail/qs/#forwarding>

  and soon I'll add a link to *this* message.

If anyone else has a Gmail account and is doing some cool things with
procmail and Gmail, please post!

I hope this is helpful,
Feedback is welcome,
Nancy
Infinite Ink
www.ii.com

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>