如何在 Perl 中将 html 页面作为电子邮件附件发送

How to send an html page as an attachment with email in Perl

我最近开始编程 我知道如何在 perl 中发送邮件,但我在 HTML 页面中生成了一个可滚动表,我需要在 Perl 中将其作为附件发送,但我不知道它。谁能帮帮我?
编辑: 这个问题与 How can I send an HTML email with Perl? 不同,我要求将 html 页面作为附件发送,而不是发送 html 电子邮件

既然你说你已经在使用 MIME::Lite,他们在他们的文档中明确说明了如何做到这一点:

$msg = MIME::Lite->new(
     To      =>'you@yourhost.com',
     Subject =>'HTML with in-line images!',
     Type    =>'multipart/related'
);
$msg->attach(
    Type => 'text/html',
    Data => qq{
        <body>
            Here's <i>my</i> image:
            <img src="cid:myimage.gif">
        </body>
    },
);
$msg->attach(
    Type => 'image/gif',
    Id   => 'myimage.gif',
    Path => '/path/to/somefile.gif',
);
$msg->send();

但是,正如评论和文档页面中所指出的那样。你真的应该使用替代品。 Mail::Sendmail works fine and tells you how to do this in their documentation