procmail
[Top] [All Lists]

Yank out attachment filename and save attachment

2007-04-16 22:01:16
Hi,

I try to yank out the filename of the attachment and save the attachment
to the original filename by:

:0 b
* .*filename
ATTACH=|grep filename 

Hoping that the line "filename=Test.xls" would go to the variable
ATTACH; and it never match. I can get it matched by use B flag instaed
of b. The ATTCH got the value "|grep" rather than the command line I
hope it will execute.

So, I try the following:
:0 B
* .*filename
|grep filename > att_name

And the log file say procmail: Skipped "|grep filename > att_name". 

:0 B
|grep filename > att_name

The result is still the same. If however, change the flag to b, then the
result would show:

procmail: Extraneous deliver-body flag ignored
procmail: Skipped "|grep filename > att_name"

Any easy way to put the filename of the attachment into a variable for
the purpose of following?

I copy this section from the procmailex manual,

              :0 b                                .---------> :0 B
              * ^Content-Type:.*application
              {
                :0 fBw
                * ^Content-Transfer-Encoding:.*quoted-printable
                | mimencode -u -q > att

                   :0 Afhw
                   | formail -I "Content-Transfer-Encoding: 8bit"

                :0 fbw                              ----------------->:0
fBw
                * ^Content-Transfer-Encoding:.*base64
                | mimencode -u -b > att64             ------------> here
should be the original filename

                   :0 Afhw
                   | formail -I "Content-Transfer-Encoding: 8bit"
              }

But it would never match unless I change the b flag to B as shown above.
The mimenocde run but the output is a very samll 350 bytes when the
origianl attachment is a 25K excel file.

Any help appreciated.

Rgds,
Kwang-Fuh Lee






____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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