v-lhb-mgr01:/root/mon# cat m5.pl
use Net::SMTP;
# mail_user should be your_mail@163.com
sub send_mail{
my $to_address = shift;
my $mail_user = 'zhao.yangjian@163.com';
my $mail_pwd = 'xxxxxxxxxxxxxx';
my $mail_server = 'smtp.163.com';
my $from = "From: $mail_user\n";
my $subject = "Subject: here comes the subject\n";
my $message = <<CONTENT;
**********************
here comes the content
**********************
CONTENT
my $smtp = Net::SMTP->new($mail_server);
$smtp->auth($mail_user, $mail_pwd) || die "Auth Error! $!";
$smtp->mail($mail_user);
$smtp->to($to_address);
$smtp->data(); # begin the data
$smtp->datasend($from); # set user
$smtp-
Perl 发送邮件
最新推荐文章于 2017-11-20 23:00:34 发布