Sending email using Perl

后端 未结 4 1731
温柔的废话
温柔的废话 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 04:51

    If the machine does not have sendmail configured, I typically use Mail::Sendmail

    use Mail::Sendmail;
    
    %mail = (smtp    => 'my.isp.com:25',
             to      => 'foo@example.com',
             from    => 'bar@example.com',
             subject => 'Automatic greetings',
             message => 'Hello there');
    
    sendmail(%mail) or die;
    

提交回复
热议问题