http://www.perlmonks.org?node_id=278523

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

Forgive me monks for asking a silly question but I can't seem to find an answer anywhere on this site or google.

I'm writing yet another web-mail client to learn and because I need something more customizable than what I'm finding already availiable. So far things have gone pretty well but I'm having trouble displaying inline images. When I receive an HTML email I try to parse it and map any images that have src="cid:<something here>" to the actual filename that is attached to the email. The problem is that the cid field doesn't seem to contain the actual filename rather, what looks like a hex string with some dollar signs etc. I assume that this information is with the actual attachment somewhere but I can't seem to figure out how to get it. I'm using MIME::Parser to parse the emails and the only filename information I can seem to get is:

$entity->recommended_filename(); # gets the real file-name

Or:
$entity->bodyhandle()->path(); # gets the internal name used by MIME:: +Parser in the tmp directory

Can someone tell me what I'm missing?

Thanks in advance!

Lobster Aliens Are attacking the world!

Replies are listed 'Best First'.
Re: Translating cid: image src to real filename
by Thelonius (Priest) on Jul 28, 2003 at 19:20 UTC
Re: Translating cid: image src to real filename
by cleverett (Friar) on Jul 28, 2003 at 18:02 UTC
    What does $entity->filename()return?

    UPDATE: also, are you sure you're sending it with a filename?

        Are you looping through the result of $msg->parts(), and then do you check for an image something like $part->type() =~ m#^image/\w+#?