[perl]代码库
1 ) 发送附件
QUOTE:#!/usr/bin/perl
use Mail::Sender;
$sender = new Mail::Sender
{
smtp => 'localhost',
from => 'xxx@localhost'
};
$sender->MailFile (
{
to => 'xxx@xxx.com',
subject => 'hello',
file => 'Attach.txt'
} );
$sender->Close();
print $Mail::Sender::Error eq "" ? "send ok!\n" : $Mail::Sender::Error;
2 ) 发送html内容
QUOTE:#!/usr/bin/perl
use Mail::Sender;
open ( IN, "< ./index.html" ) or die ( "" );
$sender = new Mail::Sender
{
smtp => 'localhost',
from => 'xxx@localhost'
};
$sender->Open (
{
to => 'xxx@xxx.com',
subject => 'xxx',
msg => "hello!",
ctype => "text/html",
encoding => "7bit",
} );
while ( <IN> )
{
$sender->SendEx ( $_ );
}
close IN;
$sender->Close();
print $Mail::Sender::Error eq "" ? "send ok!\n" : $Mail::Sender::Error;
发送带有图片或其他信息的html邮件,请看`perldoc Mail::Sender`
中的"Sending HTML messages with inline images"及相关部分。
by: 发表于:2017-09-11 11:51:34 顶(0) | 踩(0) 回复
??
回复评论