Let's use our previous example of ACM membership mail. Here's what we did before.
# forward a copy of all ACM membership mail to our buddy at the other uni # then filter it to my acm mailbox :0c * ^X-loop: membership@acm.uiuc.edu !friend@other.uni.edu # notice that we don't have to specify a condition for the next rule :0a acmThis could be rewritten with nesting as
:0
* ^X-loop: membership@acm.uiuc.edu
{
:0c
!friend@other.uni.edu
:0
acm
}
This does the same thing but is a lot more readable. You can have multiple levels of nesting
as well but we won't cover that.
# let's count exactly how many letters go through this account # we use a new flag this time. "i" means to ignore output errors. # since we're actually piping each piece of mail through my program I would normally # get an error since my program doesn't actually take any input. i will keep # the annoying messages out of my .maillog. It's really a cheap hack. :0ci | $HOME/bin/mailcount.plIf I received mail on my home computer I could have it play a sound when it got ACM membership mail and then save an extra copy before putting it into my inbox.
:0c
* ^X-loop: membership@acm.uiuc.edu
{
:0ci
|/usr/local/bin/soundplayer /usr/local/lib/acmrocks.au
:0
acm
}
Once you get the hang of it, the possibilities are endless.
Back: Matching on Regular Expressions
Top
Next: formail
j g r o s s @ s t i m p y . n e t