Here are the two subroutines I use to send email through Mime::Lite. By looking at the variables that the first sub is retrieving, you can see that I'm simply passing it an HTML file and it's plain text equivalent (for those WITHOUT HTML capabilities or email client preview windows). These files can be read by any method you like.
sub sendhtml { ($to,$from,$subject,$html_msg,$txt_msg,$mailserver)=@_; print "Sending HTML email to $to ..."; eval ### use this in case the email address is formatted incorrectly. { $status=&Send_htmlmail($to, $from, $subject, $html_msg,$txt_msg, $mailserver); print "Complete.\n"; } } sub Send_htmlmail { ($sub_to_address, $sub_from_address, $sub_subject, $sub_html, $sub_txt, $mail_server) = @_; $msg = MIME::Lite->new( To =>$sub_to_address, From =>'[EMAIL PROTECTED]', Subject =>$sub_subject, Type =>'multipart/alternative' ); $msg->attach(Type =>'TEXT', Data =>$sub_txt, Encoding=>'quoted-printable' ); $msg->attach(Type => 'text/html', Encoding=>'quoted-printable', Data =>$sub_html ); if ($mail_server) ## send remote email server { MIME::Lite->send('smtp', $mail_server, Timeout=>60) } else ## send local email server if $mailserver undef { MIME::Lite->send("sendmail"); } $msg->send; } Since this question is asked so much, I'll save a copy of this email to give others in the future ;) Regards, Agustin Rivera Webmaster, Pollstar.com / PollstarOnline.com ----- Original Message ----- From: "rory oconnor" <[EMAIL PROTECTED]> To: "Bob Showalter" <[EMAIL PROTECTED]> Cc: "perl" <[EMAIL PROTECTED]> Sent: Thursday, May 23, 2002 9:31 AM Subject: RE: MIME::Lite trouble > I did try that, but as far as I can tell, MIME::Lite::HTML fetches a web > page over the internet, parses it and includes it in a message with the > images. That's a bit overkill since the webpage is already on my > server, and I don't want to include images in the email (the image paths > are http). Is there a way to use that module to just slurp in a local > html file w/o images? > > Thanks, > > Rory > > On Thu, 2002-05-23 at 11:22, Bob Showalter wrote: > > > -----Original Message----- > > > From: rory oconnor [mailto:[EMAIL PROTECTED]] > > > Sent: Thursday, May 23, 2002 9:18 AM > > > To: perl > > > Subject: MIME::Lite trouble > > > > > > > > > I did take a listmember's suggestion and tried out MIME::Lite for > > > including a html attachment in an email. Unfortunately it's not doing > > > what I'd like it to. I'm trying to get a perl script to slurp in a > > > ..html file and e-mail it as HTML mail, just as you'd receive from > > > buy.com, amazon.com, etc. > > > > > > Even though when I look at the source it appears to be > > > formatted pretty > > > much the same as HTML mails that work (from marketers > > > mentioned above), > > > it still doesn't work! In outlook, it only shows the text part. I'm > > > totally stumped, and I'm wondering if MIME::Lite can't do this. I'll > > > include my small test script...any help is appreciated! > > > > Use MIME::Lite::HTML, part of the MIME::Lite distribution. > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]