Date sent:              Thu, 25 Jun 2009 23:27:24 -0500
From:                   Dennis Wicks <dgwi...@gmail.com>
To:                     Perl Beginners <beginners@perl.org>
Subject:                Need help with Mail::Sender

> Greetings;
> 
> Following the docs I have it working, somewhat, but it is
> not handling html w/inline images correctly.
> 
> Instead of getting an html message with inline image it is
> sending a blank email with both the html and the jpg image
> as attachments.
> 
> Here is my program. Does anyone see the problem?

Yes, the problem is very simple. Each mail client handles this 
differently. What works in one, fails with the other. This is what 
worked for me in Pegasus Mail:

#!perl
use Mail::Sender;

eval {
(new Mail::Sender)
                ->OpenMultipart({
                                to => 'je...@krynicky.cz,je...@operamail.com',
                                subject => 'Embedded Image Test',
                                boundary => 'boundary-test-1',
                                type => 'multipart/related',

                smtp=> 'xxx',
                auth => 'PLAIN',
                authid => 'xxx',
                authpwd => 'xxx',

                })
                ->Attach({
                                description => 'html body',
                                ctype => 'text/html; charset=us-ascii',
                                encoding => '7bit',
                                disposition => 'NONE',
                                file => 'c:\temp\zk.html'
                })
                ->Attach({
                                description => 'Test gif',
                                ctype => 'image/gif',
                                encoding => 'base64',
                                disposition => "inline; 
filename=\"test.gif\";\r\nContent-ID: 
<img1>",
                                file => 'D:\pix\humor\alc.jpg'
                })
                ->Close()
}
or die "Cannot send mail: $Mail::Sender::Error\n";
__END__

and the c:\temp\zk.html contained:

<html>
<body>
<p>hi again</p>

<img src="cid:img1">

<p>Ende</p>
</body>
</html>



If I send the email to my operamail account, the HTML is in the body, 
but the image doesn't display correctly.

Try to change the headers or try to post a HTML email with images 
with your mail client and see what headers does that use.

Jenda
===== je...@krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to