Perl 发邮件

email.pl

#!/usr/bin/env perl

use strict;
use warnings;

use MIME::Lite;

my $mailFrom = '[email protected]';
my $mailTo = '[email protected]';

my $mail_file = "email.pl";

my $subject = "[Hi user]";
my $msg = MIME::Lite->new(
    From => $mailFrom,
    To => $mailTo,
    Bcc => $mailTo,
    Subject => $subject,
    Type => 'text/plain',
    Encoding => 'base64',
    Path => $mail_file,
);

$msg->attach(
    Type => 'text',
    Path => 'email.md'
);

$msg->send('smtp', 'smtp.example.com');

你可能感兴趣的:(perl,perl,邮件)