use MIME:Lite; sub _mailme($$$;$) { my $msg; if (scalar @_ == 3) { my ($to, $subject); ($to, $subject, $runlog) = @_; $msg = MIME::Lite->new( From => 'MAILER-DAEMON root', To => "$to", Subject => "$subject", Type => 'multipart/related' ); $msg->attach( Type =>'TEXT/html', Data =>"See attachment!" ); $msg->attach( Type => 'TEXT', Disposition => 'attachment', Path => "$runlog", Filename => "$runlog" ); } elsif (scalar @_ == 4) { my ($to, $subjct); ($to, $subject, $runlog, $mksysblog) = @_; $msg = MIME::Lite->new( From => 'MAILER-DAEMON root', To => "$to", Subject => "$subject", Type => 'multipart/related' ); $msg->attach( Type =>'TEXT/html', Data =>"See attachment!" ); $msg->attach( Type => 'TEXT', Disposition => 'attachment', Path => "$runlog", Filename => "$runlog" ); $msg->attach( Type => 'TEXT', Disposition => 'attachment', Path => "$mksysblog", Filename => "$mksysblog" ); } $msg->send; }