Hi Everyone, I am trying to use Procmail (with subsequent tools like sed) to amend an incoming email, but I'm still not having much luck even after reading a thousand FAQs! Could somebody please help? What I am trying to do is this: 1. Deliver an email as normal, BUT 2. Amend and forward a copy of that amended email to another email address. The amendments should be: a. Insert as first line of text 'Email from John' b. Send only 160 characters of the message. 3. The added complication is that the message may, or may not, be in MIME (HTML) format, so the 160 characters need to be (I guess) extracted from the plain text part only... I know this is asking a lot, but could anyone please help? Andy
I have solved this one, but in case it helps others my solution was as follows: 1. Procmail-lib contains a fantastic script called pm-jamime-kill.rc, which does most of the hard work for you. Ensure that you have procmail-lib installed of course; it is in most of the common Linux repositories. 2. Once that is installed, add the variable declaration PMSRC='your procmail-lib directory' near the start of procmailrc. This is important - don't simply amend the path for the calling script because that in turn calls other scripts in procmail-lib. 3. Then simply add something like the following into the body of procmailrc: :0c * ^From.*some_email_address # Rem to delimit the @ with a \ { :0 * ^X-Mailer:.*(Microsoft.*Express|Mozilla|Office|AOL) { JA_MIME_TYPE = "text/html" } INCLUDERC=$PMSRC/pm-jamime-kill.rc :0 fhw | cat - ; echo "Email from Whoever: " :0 ! forwarding_email_address } That's it. I hope it works for you. Andy