procmail
[Top] [All Lists]

mime header relating to fax images

2001-02-25 11:50:39

        :0f
        *^Subject:.*page eFax
        *^Content-Type: application/octet-stream; name="[^.]+\.tif"
  ##  (line wrapped for mail  - Note extra backslash)
|sed 's/\(^Content-Type: \)\(application\/octet-stream\)\
\(; name=\"[^.]*\.tif\"\)/\1image\/tif\3/'

Content-Type: application/octet-stream; name="aeanvga9.tif"


I recently started using an online outfit to send and recieve faxes by
email ( www.eFax.com ).  They perform an fax => to => email operation and send
it on to me.

The images they send me are *.tif images but they have mime content
headers that look like:

        --==__==__A8420XZ382__==__==
        Content-Type: application/octet-stream; name="aeanvga9.tif"
        Content-Transfer-Encoding: base64
        Content-Disposition: inline; filename="aeanvga9.tif"
        Content-MD5: hQDlIJsGMxaNw/DKPKZWmg==

[...] 

        --==__==__A8420XZ382__==__==--

This confuses my mailcap settings since *.tif is considered an image
far as I know.  I seem to recall seeing it listed as such in an RFC
once apon a time.

Is this something I should take up with eFax.com?  Or is this
compliant with what RFCs have to say about mime?

I have a hunch my mail/news app, `gnus', can do something for this
that I don't know how to do, but currently, gnus only offers to save
the file for me.

For the time being I'm using a `procmail' solution and have it
rewrite the Mimeheaders replacing "application/octet-stream" with
"image/tif"
        
        :0f
        *^Subject:.*page eFax
  ##  (line wrapped for mail  - Note extra backslash)
|sed 's/\(^Content-Type: \)\(application\/octet-stream\)\
\(; name=\"[^.]*\.tif\"\)/\1image\/tif\3/'

Along with the mailcap setting:
        `image/tif; viewfax %s'

This seems to work without breaking anything I've noticed, and gnus
opens them neatly with `viewfax'

But I have a feeling there are bigger issues here.  Or is this just a
case of `eFax.com' blundering?

Another aspect here is the possibility of the sed REGEXP double
dipping somewhere it isn't supposed to.  Doesn't look like it would
but to fortify against that possibility I tried to add another
condition to the recipe:

        :0f
        *^Subject:.*page eFax
        *^Content-Type: application/octet-stream; name=\"[^.]*\.tif\"
  ##  (line wrapped for mail  - Note extra backslash)
|sed 's/\(^Content-Type: \)\(application\/octet-stream\)\
\(; name=\"[^.]*\.tif\"\)/\1image\/tif\3/'

But the Regexp at *^Content...  misses this line:

        Content-Type: application/octet-stream; name="aeanvga9.tif"

And the log shows it not matching.

I've tried a few renditions but none have worked:

(without escaping the double quotes)
        *^Content-Type: application/octet-stream; name="[^.]*\.tif"

(using the + operator instead of * [ with and without quote escapes])
        *^Content-Type: application/octet-stream; name=\"[^.]+\.tif\"

Some of those work with sed and with vi, but not procmail.

Can someone see what is wrong here?

I seem to remeber that without :0hb  the default is to include header
and body.  But just in case I also tryid `:0hbf'
_______________________________________________
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>