[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Extracting email headers



Hi,

The problem is really simple.

I receive email on my long commute, and I'd like to be able to send some
of the more important messages to my cellphone, so I can make the
necessary calls.

The trouble is that my cellphone can only receive about 100 characters
in the body of the email. So my plan is to use a procmail recipe to
filter out the important messages and send the subject and the sender's
name in the subject line of the email to the cellphone; then the body of
the email will have the first 100 characters from the body of the
original email.

I am trying to use formail to extract the "From: " and "Subject"
headers, and then use tr to put them one line by eliminating the
newline. However, I am having no success in this. I have read the
manuals and tried all the options. Obviously, this is not working.

Could somebody provide some pointers on how to retrieve two headers from
the email and combine them into one line?

Even better if somebody has a more eloquent solution :-}.


Here's what I am trying to do. Only the relevant lines are shown.

Original email received by my machine in the office:
----------------------------------------------------------
From: somebody.important@company.com
To: Andy@company.com
Subject: Urgent issue

Andy,
We need to discuss this issue with the management immediately. This
issue pertains to the following matters... blah blah blah

Mr. Important
----------------------------------------------------------

Email to the cellphone:
----------------------------------------------------------
From: Andy@company.com
To: Andy@cellphone.com
Subject: somebody.important - Urgent issue

Andy,
We need to discuss this issue with the management immediately. This
issue pertains to the follow

----------------------------------------------------------

Thanks,
Andy



Reply to: