procmail
[Top] [All Lists]

Re: editing body of message with Formail

1999-04-19 13:51:28
Tom Adler asked,

| When Groupwise forwards a message, it creates a new header.  The header
| information from the original message appears as the first lines in the
| BODY of the forwarded message.  Thus, the message body of all my forwarded
| e-mails begins with Date, From, To, Subject, Mime-Version,Content-Type,
| Content-Transfer-Encoding, and Content-Disposition lines.  The actual
| "meat" of the message follows all of this.

| Unfortunately, my pager only displays the first 200 characters of the message
| body.  I can never see the desired content information. All I get is the
| regenerated header information.

| I have read the Formail man pages but my knowledge is limited.  I don't
| know if what I want to do is possible (eliminate the first unimportant
| lines of my forwarded message body).  Can anyone help?  My .procmailrc
| recipe on my home account looks something like this:

| #if the e-mail is from my work account, then forward a copy to my pager
| :0c
| *^From:(_dot_)*me(_at_)work
| !mypager(_at_)pagenet(_dot_)net
| 
| How could I insert a formail section into this recipe to accomplish my goal?

You have two options, Tom: either reattach those orphaned headers to the head
or delete the orphaned headers.  I'd go with the first, because then the copy
you keep will also have full correct headers.

 :0fwh
 * ^From:(_dot_)*me(_at_)work
 | formail -X ""  # space required between X and quotes
  :0ac
  ! mypager(_at_)pagenet(_dot_)net

If you want to go the second way,

 :0c:
 * ^From:(_dot_)*me(_at_)work
 $DEFAULT
  :0Afwb # remove first paragraph from body
  | sed 1,/^$/d
  :0a
  ! mypager(_at_)pagenet(_dot_)net

One of the nice things about procmail's `f' flag is that with it we can clean
up email that arrives in bad shape from other mailers.

<Prev in Thread] Current Thread [Next in Thread>