procmail
[Top] [All Lists]

Re: would this work in a recipe?

2002-05-02 15:48:31
At 16:07 2002-05-02 -0400, Pantelis Hadzipantelis did say:
On another note, why use ^Content-Type? if you look at the Content-Type of
an email you do not get a filename extension...

I guess I'll defer to your extensive experience here.

Content-Type is first checked for in the HEADERS, to determine if this is a multipart message which deserves even waste the cycles checking the BODY for the attachment names. The grep operations (please see 'man grep') locate Content-Type lines in the **BODY** (note the curious use of the 'B' flag on the inner recipe), *AND* the line following them, pipes that into a grep that just retains the name lines, and finally into the egrep which looks for lines (within that VERY limited subset) that DO NOT match the criteria of having extensions which your inquiry was about.

You should spend some time examining a VARIETY of messages in your inbox, from a VARIETY of sources and mail clients. IME, Content-Disposition: is always accompanied by a Content-Type: in the mime chunk, both with filenames, but *MANY* messages with attachments lack a Content-Disposition: in the mime chunks, although the Content-Type: is still present, with filename (unless it is an non-file attachment such as an HTML or plaintext message body).

Perhaps the most glaring example of this is the most pervasive email client available: MS Outlook.

Oh, and lest it be overlooked, since the mime chunks are in the message BODY, continued lines are NOT concatenated, so if you use an external tool to isolate the lines you need, you won't always find (again, IME, rarely will you find) the filename on the same line as the Content-whatever 'header'.

If the messages you receive ALWAYS have the Content-Disposition 'header', and you have no specific concern about interraction with "regular" messages, do it whatever way you see fit.

[BA snip again]

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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