I've encountered some problem when configuring my linux machine.
We are configuring fetchmail and procmail in order to receive the email from the external mail server.The problem start when we want to get the body content of the email by using "pipe" command in the procmail recipe.
:0fbw
| head -10
We discover that we cannot separate the mime part of the email with the body content of the email.Some of the output will show like this:
Received: by 10.52.155.193 with SMTP id vy1mr1915645vdb.123.1337929665158;
Fri, 25 May 2012 00:07:45 -0700 (PDT)
Received: by 10.52.34.75 with HTTP; Fri, 25 May 2012 00:07:45 -0700 (PDT)
Date: Fri, 25 May 2012 15:07:45 +0800
Message-ID: <CAE1Fe-oWCcM=K9+Nzx1c8kpDd80X3NXmf7XT_8L_KphGVczS=Q@mail.gmail.com>
Subject: test procmail
From: newbie my <newbie.my@gmail.com>
To: qaf azmi <qafazmi@gmail.com>
Content-Type: multipart/alternative; boundary=bcaec53ae9ee6d1da904c0d706c2
--bcaec53ae9ee6d1da904c0d706c2
Content-Type: text/plain; charset=ISO-8859-1
hi there.this is for testing only.
--bcaec53ae9ee6d1da904c0d706c2
Content-Type: text/html; charset=ISO-8859-1
hi there.this is for testing only.<br>
--bcaec53ae9ee6d1da904c0d706c2--
We only need the content of the body.So we figure out to convert this email into plain text.Then we will read try to take out the content by defining the content line in AWK. Its a big problem when different kind of email (ex:gmail,yahoo,etc)have their own format.So reading by line seems impossible as we do not know which line to read for the incoming email. Can anybody shed some light on this?Or different solution that we can take to tackle this problem?Thanks.