SendingHTML files via e-mail

B

btna

Hi all,

I am trying to write a simple Perl script that will accept the HTML
file as one argument and then send an e-mail with the HTML file. I
don't want the HTML file attached to the e-mail but to be part of the
body of the e-mail. In other words, I need the HTML file that I am
sending to be the actual body of the e-mail.
I am new to Perl so this is what I have so far:

use strict;
use MIME::Lite;
use Date::Calc qw:)all);

# SendTo email id
my $to_id = '(e-mail address removed)';
my $filename=$ARGV[0];
chomp (my $date = `date +%A" "%B" "%d","%Y`);
my $subject = sprintf("SAN Capacity Report:
%s",Date_to_Text_Long(Today()));

# create a new MIME Lite based email
my $msg = MIME::Lite->new
(
From => '(e-mail address removed)',
To => $to_id,
Subject => $subject,
Type => 'multipart/mixed',
);

$msg->send();

I am not sure how to make the $filename which is the HTML file passed
to the script so it gets sent as part of the body of the e-mail.

Any help would be appreciate it.

Thanks,

BTNA
 
G

Gunnar Hjalmarsson

btna said:
I am not sure how to make the $filename which is the HTML file passed
to the script so it gets sent as part of the body of the e-mail.

I'm not sure either, but did you read the docs for MIME::Lite?

perldoc MIME::Lite

It contains several examples that ought to work as a guidance.

Try to modify your script with help of the docs, and come back if you
don't find a solution that way.
 

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,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top