cfsky 发表于 2018-9-1 08:46:05

perl脚本发送邮件

use Mail::SendEasy ;  my $mail =new Mail::SendEasy(
  smtp => 'localhost' ,   #SMTP服务器
  user=> 'foo' ,         #认证用户名
  pass => 123 ,         #认证密码
  );
  #SMTP端口默认为25,连接超时时间默认为120秒
  my $status = $mail->send(
  from    =>'sender@foo.com' ,   #发送者邮件地址
  from_title => 'Foo Name',         #发件人名字或标题
  reply   => 're@foo.com' ,         #回复信件地址
  error    => 'error@foo.com' ,      #发送出错信息地址
  to      =>'recp@domain.foo' ,   #接受邮件地址
  cc      => 'recpcopy@domain.foo', # 接受邮件副本地址
  subject => "MAIL Test" ,         # 邮件主题
  msg      => "The Plain Msg..." ,#文本格式邮件内容
  html    => "TheHTML Msg..." , #html格式邮件内容,有这个则msg无效
  msgid   => "0101", #给邮件头加一个ID号
  ) ;
  if (!$status) { print $mail->error;}

页: [1]
查看完整版本: perl脚本发送邮件