[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Need help with Mail::Sender



Greetings;

Following the docs I have it working basically, but it is not handling html w/inline images correctly.

Instead of getting a 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@mgssub.com',
	auth    => 'LOGIN',
    authid  => 'tfrg@mgssub.com',
    authpwd => 'xxxxxxx'
	} );
ref $sender or die
  "Object creation failed: $Mail::Sender::Error\n";

my $recipients = 'gramps@mgssub.com';

 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";}


Reply to: