Perl发送邮件模块比较

前端之家收集整理的这篇文章主要介绍了Perl发送邮件模块比较前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

 Perl发送邮件模块比较

@H_301_16@
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.
初看一眼,丫看名字跟邮件好像关系不大.但是仔细一看丫貌似什么功能都有
靠..藏得太深了.我好不容易找到.这家伙好用极了! 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();

猜你在找的Perl相关文章