Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > MIME::Lite HTML message handling

Thread Tools

MIME::Lite HTML message handling

John B. Kim
Posts: n/a
I am working on the code below:
************************************************** ****
use strict;
use MIME::Lite;
use Net::SMTP;
my $from = '(E-Mail Removed)';
my @addweek1 = qw((E-Mail Removed) Removed)
my $Fnameweek1 = 'JNIssue11.pdf';
my $subject='Issue 11';
my $message = 'C:\\message1.html';
for my $address (@addweek1) {
my $msg = MIME::Lite->new (
From => $from,
To => $address,
Subject => $subject,
Type =>'multipart/related');

$msg->attach (
Type => 'text/html',
Data => qq{$message});

$msg->attach (
Type => 'x-pdf',
Path => "c:\\guide\\JNIssue11\\$Fnameweek1",
Filename => $Fnameweek1);
MIME::Lite->send('smtp', '');
The above codes attach the pdf file I have in my hard drive and send the
email to multiple recepients with pdf attachments. Now I use this codes to
send messages with different attachments and different HTML messages to the
same group of recipients. With the codes above I can just change the name
and location of new attachment with different version of emailing, but for
now I have to always copy and paste lengthy html message after qq{..

What I would like to realize is through my $message = 'C:\\message1.html', I
wish qq{$message reads the contents of c:\message1.html.

However, when I run the above codes, rather than seeing the html message in
the email body, I just see c:\message.html in the body of the email sent.

It probably is something simple for an experienced Perl programmer, but as a
beginer, I cannot figure what to put after Data => qq{ so that the content
of c:\message.html be place as email body.

Any help will be deeply appreciated. I hope my message is clear enough so
that people understand what I am struggling about.

Reply With Quote
Joe Smith
Posts: n/a
John B. Kim wrote:

> my $message = 'C:\\message1.html';
> ...
> $msg->attach (
> Type => 'text/html',
> Data => qq{$message});

Have you tried changing that to
Path => $message,
Filename => $message;

I love my TiVo -
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
signal handling and (structured) exception handling Peter C++ 34 10-17-2009 10:03 AM
python list handling and Lisp list handling Mark Tarver Python 22 04-26-2009 09:36 PM
Is faster handling hexadecimal values than handling chars? IƱaki Baz Castillo Ruby 1 04-15-2008 09:04 AM
Combining message.BodyFormat = MailFormat.Html & message.BodyFormat = MailFormat.Text =?Utf-8?B?bWc=?= ASP .Net 1 02-08-2004 10:43 PM
How to send an html message with inline images and text for non html mail clients? John Sutter ASP .Net 0 01-13-2004 08:08 PM