KB 68
How do I filter mail by domain to forward some mail to my cellphone?
Article:68 Created:2000-08-04 09:00:37 Categories: E-mail
Question or Symptom
Can one set up a filter in the email account/system to forward email from specific domains to a different email account? I would like to forward some email from my swcp account to the email account tied to my cell phone.
Resolution
You can do this with procmail by filtering on the From line.
Procmail can be difficult to configure the first time. You can ask the staff to do it for you or the following are some available resources:
The two best sources of documentation are:
man procmail
man procmailrc
man procmailex
Procmail is driven by a configuration file called .procmailrc in a user's home directory. The procmailrc man page describes the format of the .procmailrc file. The procmailex man page has .procmailrc examples.
There are some interesting links on
http://www.procmail.org/
A .procmailrc usually consists of a few variable definitions followed by filtering rules.
Here is a sample .procmailrc:
PATH=$HOME/bin:/usr/bin:/bin:/usr/local/bin MAILDIR=$HOME/Mail LOGFILE=$MAILDIR/.from DEFAULT=/var/spool/mail/myloginname ### ### fax messages ### :0 * ^From:.*fax@swcp.com fax
The variables setup a path for looking up programs (PATH), a directory for relative file references (MAILDIR), the location of a log file (LOGFILE), and a file where procmail delivers messages that aren't filtered (DEFAULT).
This procmailrc delivers any messages with a From header that matches "fax@swcp.com" to a file in MAILDIR named "fax".
Related URLS
http://www.procmail.org/