SendingHTML files via e-mail

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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 = '';
my $filename=$ARGV[0];
chomp (my $date = `date +%A" "%B" "%d","%Y`);
my $subject = sprintf("SAN Capacity Report:

# create a new MIME Lite based email
my $msg = MIME::Lite->new
From    => '',
To      => $to_id,
Subject => $subject,
Type    => 'multipart/mixed',


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.



Re: SendingHTML files via e-mail

btna wrote:
Quoted text here. Click to load it

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

Site Timeline