Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SendingHTML files via e-mail

0 views
Skip to first unread message

btna

unread,
Jun 24, 2008, 9:30:36 AM6/24/08
to
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 = 'a...@abc.com';
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 => 'ro...@abc.com',
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

Gunnar Hjalmarsson

unread,
Jun 24, 2008, 9:50:39 AM6/24/08
to
btna wrote:
> 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.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

0 new messages