Use maildrop to forward a mail to another mail box

I recently had the need to forward e-mail based on the from field to another mailbox. I know, it's possible with a simple .forward in your $HOME, but that will forward all the mail. :-(


So after some further searching I end up with the following rule for your maildrop filter... it simply checks if the mail (in this example) is from [email protected]  and will forward it to [email protected]:


if ( /^From: .*[email protected].*/ )
{
        dotlock "forward.lock" {
          log "Forward mail"
          to "|/usr/sbin/sendmail [email protected]"
        }
}


And that's all you need to put add to your $HOME/.mailfilter