using Mail::Sender to send email with attachment

E

eddiekwang

Hello,

I am using perl on a Windows XP workstation. I need to use a perl
script to send out an email with a html body and a pdf attachment.

I was able to use the following code to send out an email with html
body successfully, but I can't seem to add the attachment. when I tried
the Attach method, both the html and pdf showed as attachment.

Does anyone have an example on how to do this using Mail::Send?

(I tried MIME::LITE and got an error - "'sendmail' is not recognized as
an internal or external command ...". maybe Windows doesn't support
MIME::LITE? )

Any suggestions will be greatly appreciated.
Eddy,

*******************
use Mail::Sender;

$htmlfile = 'C:\temp\my_perl\weekOne.html'; # Name the file
open IN, $htmlfile or die "Cannot open $htmlfile : $!\n";

$sender = new Mail::Sender{smtp => 'smtp.ucsd.edu'};

$sender->Open({ from => '(e-mail address removed)', to => '(e-mail address removed)',
subject => 'HTML test',
ctype => "text/html",
encoding => "quoted-printable"
}) or die $Mail::Sender::Error,"\n";

while (read IN, $buff, 4096) { $sender->SendEnc($buff) };
close IN;

$sender->Close();
********************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top