加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

perl 发送邮件代码

发布时间:2020-12-16 00:31:55 所属栏目:大数据 来源:网络整理
导读:#!/usr/bin/perl use strict; use warnings; use Net::SMTP; use MIME::Base64; use Encode; use MIME::Lite; my $from = '123@163.com'; #my ($to,$subject,$msg) = @ARGV; #lupengfei my ($to,$cc,$msg) = @ARGV; my @to = split /,/,$to; #lupengfei my @
#!/usr/bin/perl use strict; use warnings; use Net::SMTP; use MIME::Base64; use Encode; use MIME::Lite; my $from = '123@163.com'; #my ($to,$subject,$msg) = @ARGV; #lupengfei my ($to,$cc,$msg) = @ARGV; my @to = split /,/,$to; #lupengfei my @cc = split /,$cc; my $smtp = Net::SMTP->new('111.22.11.22',? ? ? ? ? ? ? ? ? ? ? ? ? Hello => 'snda.com',? ? ? ? ? ? ? ? ? ? ? ? ? Timeout => 30,? ? ? ? ? ? ? ? ? ? ? ? ? Debug => 0,? ? ? ? ? ? ? ? ? ? ? ? ?); $smtp->mail($from); $smtp->recipient(@to,{SkipBad => 1}); #lupengfei $smtp->recipient(@cc,{SkipBad => 1}); $subject = encode("gb2312",decode("utf8",decode_base64($subject))); $msg = encode("gb2312",decode_base64($msg))); my $html_msg = MIME::Lite->new ( ? ? ? ? ?From => $from,? ? ? ? ?To => $to,? ? ? ? ?#lupengfei ? ? ? ? ?cc => $cc,? ? ? ? ? ? ? ? ? ?Subject => $subject,? ? ? ? ?Type => 'text/html',? ? ? ? ?Data=> $msg ? ? ? ?) or die "Error creating inline email $!n"; $html_msg->attr('content-type.charset' => 'gb2312'); $smtp->data(); print $html_msg->as_string(); $smtp->datasend($html_msg->as_string()); $smtp->dataend(); $smtp->quit;

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读