Sending email using Perl

后端 未结 4 1736
温柔的废话
温柔的废话 2020-12-20 04:19

I’m trying to use Perl to send an email message. Basically I have a Perl script that prints out a report in a nice format. I want that report to be sent via email. How can I

4条回答
  •  不思量自难忘°
    2020-12-20 05:15

    MIME::Lite is a strong module used by many. It's easy to use, including if you want to attach documents.

    use MIME::Lite;
    my $msg = MIME::Lite->new(
        From    => $from,
        To      => $to,
        Subject => $subject,
        Type    => 'text/plain',
        Data    => $message,
    );
    $msg->send;
    

    Since it uses sendmail by default (as opposed to SMTP), you don't even need to configure it.

提交回复
热议问题