Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Translating cid: image src to real filename

by cfreak (Chaplain)
on Jul 28, 2003 at 17:58 UTC ( #278523=perlquestion: print w/replies, xml ) Need Help??
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

$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+#?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://278523]
Approved by blue_cowdawg
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2017-04-28 05:06 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (517 votes). Check out past polls.