David Newman wrote:
> I'm trying to include a PDF image both inline and as an attachment to an 
> HTML email. The MIME::Lite module supports this, and the documentation 
> even gives an example:
> 
> http://tinyurl.com/uemf7
> 
> However, when I try this with the code below, the inline image doesn't 
> display. (The attachment is fine, though.) This is puzzling given that 
> it's basically the same code as in the example above.
> 
> I'm new to <img src=cid: > tags. I've also tried this with "<img 
> src=cid:08Bike.pdf>" but that doesn't display inline either.
> 
> How to get this working?
> 
> Many thanks
> 
> dn
> 
> #!/usr/bin/perl -w
> 
> use strict;
> use MIME::Lite;
> 
> my $msg = MIME::Lite->new(
>      To      =>'[EMAIL PROTECTED]',
>      Subject =>'HTML with in-line images!',
>      Type    =>'multipart/related'
>      );
> 
> $msg->attach(Type => 'text/html',
>      Data => qq{ <body>
>          Here's <i>my</i> image:
>          <img src="cid:bike">
>          </body> }
> );
> 
> $msg->attach(Type => 'application/pdf',
>      Id   => 'cruisin',
>      Path => '/home/someuser/08Bike.pdf'
>      );
> 
> $msg->send();

The src attribute of an HTML <img> element must be the URI of an image resource
acceptable to the HTML renderer on your platform. I have never heard of anything
that supports formats other than GIF, JPG or PNG files, so I don't th/ink your
PDF file stands a chance. I don't know any way of rendering a PDF file as a
component of an HTML page.

CID is an abbreviation for Content ID, and must be the ID of one of the mail's
attachments. You have given the only attachment an ID of 'cruisin', so you would
want to write

  <img src="cid:cruisin">

But I would prefer to see something based on the resource name, something like

  <img src="cid:08Bike.jpg">

and

  Id   => '08Bike,jpg',
  Path => '/home/someuser/08Bike.jpg',

HTH,

Rob

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to