By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,813 Members | 1,236 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,813 IT Pros & Developers. It's quick & easy.

MIME::Lite HTML message handling

P: n/a
I am working on the code below:
************************************************** ****
use strict;
use MIME::Lite;
use Net::SMTP;
my $from = 's****';
my @addweek1 = qw(mi*****
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.

Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply

P: 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 -
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.