Currently my procmail recipes are as below:
FROM_=`formail -c -x"From "| awk '{ print $1 }'`
SUBJ_=`formail -c -x"Subject:" | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`
:0
*^Subject:.*(60)
{
:0 fwh
| formail | (echo "$FROM_"; echo "$SUBJ_";)
:0 fwb
| formail -I ""
:0
myemail/
}
My procmail recipe will only filter out the emails that have number "60" in their subject. After that formail will execute taking out the sender's email address and its subject before forwarding it together with its content to the "myemail" directory.
Can someone help me to construct a procmail recipe to filter incoming mails into different directories if there are multiple "60" seperated by commas in the subjects?
(For example,the email with subject 6010,6011,6012,.. the 6010 will go into 6010 folder,6011 will go into 6011 and so on.)
The numbers in the subject are phone numbers, there can be a large number of different ones so enumerating all the possible matches is not really an option.