Sendmail with html attachment and html body

Hi folks,

I have a perl script which sends out email after successful completion of job as inline html, I want to send it out as two parts now as html inline and html attachment. see the attached script.

Thanks in advance

You might try something like this as an example:

#!/usr/bin/perl

use Net::SMTP;
use MIME::Lite;
use Getopt::Long;

### Adjust sender, recipient and your SMTP mailhost
my $from_address = ""$local_user"."\@m99llaax045.xxx.com";
my $to_address = "$email_alias";
my $mail_host = 'localhost';

### Adjust subject and body message
my $subject = 'A message with 1 part ...';
my $message_body = "Here's the attachment file(s) you wanted";

### Adjust the filenames
my $my_file_txt = $rptFile;
my $your_file_txt = $rptFile;
my $message_type = 'text/html';

GetOptions(
'to_address=s' => \$to_address,
'subject=s' => \$subject,
'body=s' => \$message_body,
'my_file_txt=s' => \$my_file_txt,
'your_file_txt=s' => \$your_file_txt,
'type=s' => \$message_type,
);

### Create the multipart container
$msg = MIME::Lite->new (
From => $from_address,
To => $to_address,
Subject => $subject,
Type =>'multipart/mixed'
) or die "Error creating multipart container: $!\n";

### Add the text message part
$msg->attach (
Type => 'TEXT',
Data => $message_body
) or die "Error adding the text message part: $!\n";

### Add the TXT file
$msg->attach (
Type => $message_type,
Path => $my_file_txt,
Filename => $your_file_txt,
Disposition => 'attachment'
) or die "Error adding $my_file_txt: $!\n";

### Send the Message
MIME::Lite->send('smtp', $mail_host, Timeout=>60);
$msg->send;

exit;