Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi.

I just implemented a web based email client (oakbox). The problem is that it doesn't support attachements. So what I want to do is add this capability to it.

Basically, I need to get the raw data that comes for a TIF image in an email, and pump this out to a temporary image file. When looking at the message with this email client, a lot of 'junk' comes out, like this...

--====================54535wsbgyj==== Content-Type: text/plain; charset=us-ascii Thank you for Using K7.NET. Double Click on Attachment to View Fax. --====================54535wsbgyj==== Content-Type: application/octet-stream; name="FAX20633933209_3107983105.TIF" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="FAX20633933209_3107983105.TIF" SUkqAAgAAAAUAP4ABAABAAAAAAAAAAABBAABAAAAwAYAAAEBBAABAAAAJAQA AAIBAwABAAAAAQAAAAMBAwABAAAAAwAAAAYBAwABAAAAAAAAAAoBAwABAAAA AgAAAA4BAgBGAAAA/gAAABEBBAABAAAAVAEAABUBAwABAAAAAQAAABYBBAAB AAAAJAQAABcBBAABAAAAFzsAABoBBQABAAAARAEAABsBBQABAAAATAEAACQB BAABAAAAAAAAACgBAwABAAAAAgAAACkBAwACAAAAAQAAAEYBBAABAAAAAAAA AEcBAwABAAAAAAAIAEgBBAABAAAAAAAAAAAAAAAgICAgICAgICAgMzEwNzk4 MzEwNSAgICAgICAgICAgICAgICAgSzdGQVggIFR1ZSBOb3YgMDYgMTc6NTM6 MDMgMjAwMQoAzAAAAAEAAABiAAAAAQAAAAAomxUAZbMCoGxWAJTNCoCyWQFw q5qw/IxmdDmjGc1oNq0JVIFmdGc0m0APfmhGM5pNoAe3o0J6fp5AG9wEGc4n 0AZHR7OTAgC38j7fl3/ne/B3vs/3+d6n3ufnEef7vZzvfX5+uc/3+T7f+/x8 b1c++3z7+bxvAjr/9vN5H/p87ycFAG7Sl6vz5x5xPt+f+3MedH7+zD/3W3Ge

This continues for a couple of lines more. So what I want to do is generate an image file out of this.

Anyone know how to do this?

I've tried splitting the data and getting only the good 'garbage' from there and pumping it out to a tif file in binary mode, but it doesn't work. Any ideas?

Thanks,
Ralph.

Replies are listed 'Best First'.
(ichimunki) Re: Processing Attachements
by ichimunki (Priest) on Nov 08, 2001 at 05:22 UTC
    It says the content is encoded in base64 for transport, so I'd guess you'd want to feed that data to MIME::Base64 for decoding before trying to make a TIFF out of it. I'd also search the other MIME modules on CPAN to see if any of them can assist in getting the attachment(s) out of the email text.
Re: Processing Attachements
by Anonymous Monk on Nov 08, 2001 at 06:22 UTC
    Yes! It worked! Thanks a lot :-)

    When decoding the good 'garbage' it creates the image file correctly.

    Thanks,
    Ralph :-)