perl.beginners
[Top] [All Lists]

Need help with Mail::Sender

Subject: Need help with Mail::Sender
From: Dennis Wicks
Date: Thu, 25 Jun 2009 23:27:24 -0500
Newsgroups: perl.beginners


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?

Many TIA!
Dennis

 === === program follows  === ===

> #!/usr/bin/perl
>
> use strict;
> use warnings;
> use Mail::Sender;
>
> my $image = 'kitten.jpg';
>
> my $sender = Mail::Sender->new( {
>     smtp   => 'smtpout.secureserver.net',
>     port   => '3535',
>     from   => 'tfrg@xxxxxxxxxx',
>    auth    => 'LOGIN',
>     authid  => 'tfrg@xxxxxxxxxx',
>     authpwd => 'xxxxxxx'
>    } );
> ref $sender or die
>   "Object creation failed: $Mail::Sender::Error\n";
>
> my $recipients = 'gramps@xxxxxxxxxx';
>
>  if (ref $sender->OpenMultipart({
>    to => $recipients,
>    subject => 'Test Sending HTML and inline message',
>    boundary => '--boundarytest1',
>    multipart => 'related'})) {
>        $sender->Attach(
>            {description => 'html body',
>            ctype => 'text/html; charset=us-ascii',
>            encoding => '7bit',
>            disposition => 'NONE',
>            file => 'test-inline.html'
>            });
>        $sender->Attach({
>            description => 'kitten-1',
>            ctype => 'image/jpg',
>            encoding => 'base64',
> disposition => "inline; filename=\"$image\";\r\nContent-ID: <img1>",
>            file => "$image"
>            });
> $sender->Close() or die "Close failed! $Mail::Sender::Error\n";
>        } else {
>        die "Cannot send mail: $Mail::Sender::Error\n";}

<Prev in Thread] Current Thread [Next in Thread>