perl 脚本 发送邮件
perl 脚本 发送邮件代码
#!/usr/bin/perl -w
use Mail::Sender;
open my $DEBUG, ">> /tmp/mail.log" or die "Can't open the debug file: $!\n";
$sender = new Mail::Sender
{smtp => 'smtp_server',
from => 'send@mail.com'};
#发送普通邮件
$sender->MailMsg(
{to => 'NinGoo@test.com',
subject => 'test mail',
msg => 'hello word',
debug => $DEBUG
});
#发送带附件的邮件
$sender->MailFile(
{to => 'NinGoo@test.com',
subject => 'test mail with attached file',
msg => 'hello word',
file => '/tmp/test.txt'
debug => $DEBUG
});
页:
[1]