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

Perl发送邮件模块比较

发布时间:2020-12-16 00:28:55 所属栏目:大数据 来源:网络整理
导读:? Perl发送邮件模块比较 1.Mail::Sendmail,用这个模块发邮件很简单,可是貌似也只能处理简单的邮件... use Mail::Sendmail; %mail = ( To = 'you@there.com', From = 'me@here.com', Message = "This is a very short message" ); sendmail(%mail) or die $Ma

?Perl发送邮件模块比较

1.Mail::Sendmail,用这个模块发邮件很简单,可是貌似也只能处理简单的邮件...
use Mail::Sendmail;

%mail = ( To => 'you@there.com',
From => 'me@here.com',
Message => "This is a very short message"
);

sendmail(%mail) or die $Mail::Sendmail::error;

print "OK. Log says:n",$Mail::Sendmail::log;

2.Mail::Sender
这家伙能发送带附件的,不过得通过SMTP服务器,我测试了一下失败...
找到一个例子是用网易的,不过我测试一下Login not accepted...好吧

use Mail::Sender;
$sender = new Mail::Sender
{smtp => 'mail.yourdomain.com',from => 'your@address.com'};
$sender->MailFile({to => 'some@address.com',
subject => 'Here is the file',
msg => "I'm sending you the list you wanted.",

3


file => 'filename.txt'});

3.找到MIME::Lite.
初看一眼,丫看名字跟邮件好像关系不大.但是仔细一看丫貌似什么功能都有
  • Create a simple message containing just text
  • Create a simple message containing just an image
  • Create a multipart message
  • Attach a GIF to a text message
  • Attach a pre-prepared part to a message
  • Print a message to a filehandle
  • Print a message into a string
  • Send a message
  • Send an HTML document... with images included!
  • Change how messages are sent
靠..藏得太深了.我好不容易找到.这家伙好用极了! use MIME::Lite; $msg = MIME::Lite->new( From??? => 'me@myhost.com',To?????? => 'me@ahaha.com',#Cc????? => 'some@other.com,some@more.com',Subject => 'you have got a message',Type??? => 'multipart/mixed' ); ### Add parts (each "attach" has same arguments as "new"): $msg->attach( Type???? => 'TEXT',Data???? => "Here's the GIF file you wanted" ); $msg->attach( Type???? => 'AUTO',Path???? => '111.txt',Disposition => 'attachment' ); ### use Net:SMTP to do the sending $msg->send();

(编辑:李大同)

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

    推荐文章
      热点阅读