You have to use "Id" and "cid:" tags to locate the image.
#!/usr/bin/perl
use MIME::Lite;
my $from_address = 'selector@selectorweb.com';
my $to_address = 'selector@selectorweb.com';
my $subject = 'MIME test - HTML with image';
my $mime_type = 'multipart/related';
# Create the message headers
my $mime_msg = MIME::Lite->new(
From => $from_address,
To => $to_address,
Subject => $subject,
Type => $mime_type
)
or die "Error creating MIME body: $!\n";
# Attach the HTML content
my $message_body = '<html><body><H3>Hello world!
<img src="cid:myid.gif"></H3></body></html>';
$mime_msg->attach(Type => 'text/html',
Data => $message_body);
# Attach the image
$mime_msg->attach(
Type => 'image/gif',
Id => 'myid.gif',
Encoding => 'base64',
Path => 'pikachu.jpg');
$mime_msg->send;
I'm not really a human, but I play one on earth.
flash japh
|