-1

I recently started programming I know how to send a mail in perl, but I am generating a Scrollable tables in HTML page and I need to send it as an attachment in Perl and I have no idea about it. Could anyone help me?
Edit: This question is different then How can I send an HTML email with Perl?, I am asking for send html page as an attachment rather then sending a html Email

Community
  • 1
  • 1
AbhiNickz
  • 1,035
  • 2
  • 14
  • 32
  • you need to create a multi-part message refer to this module http://search.cpan.org/~rjbs/MIME-Lite-3.030/lib/MIME/Lite.pm and look at this section : Create a multipart message (i.e., one with attachments) and send it SMTP – smith Apr 20 '15 at 21:11
  • 1
    @smith FYI, the docs for MIME::Lite say, "**WAIT!** MIME::Lite is not recommended by its current maintainer. There are a number of alternatives, like Email::MIME or MIME::Entity and Email::Sender, which you should probably use instead. MIME::Lite continues to accrue weird bug reports, and it is not receiving a large amount of refactoring due to the availability of better alternatives. Please consider using something else." – ThisSuitIsBlackNot Apr 20 '15 at 21:29
  • MIME::Lite was my goto module for sending email. I'm not sure I'm ready to let go :-) – Len Jaffe Apr 20 '15 at 22:16
  • What module do you currently use to send your emails? – ikegami Apr 21 '15 at 03:10
  • I am using this module "use MIME::Lite;" for mails – AbhiNickz Apr 21 '15 at 09:11
  • 1
    @jkeuhlen This is not a duplicate Question. – AbhiNickz Apr 21 '15 at 12:10

1 Answers1

1

Since you said you are already using MIME::Lite, they explicitly say how to do this in their documentation:

$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();

However, as has been pointed out in the comments and on their documentation page. You should really use an alternative. Mail::Sendmail works fine and tells you how to do this in their documentation

jkeuhlen
  • 4,401
  • 23
  • 36