正在加载...

Perl 发送邮件

[ 2009/11/01 18:51 | by selboo ]

安装
tar -zxvf Mail-Sender-0.8.16.tar.gz
cd Mail-Sender-0.8.16
perl Makefile.PL
make && make install

[root@jishu localhost]$ cat smail
#!/usr/bin/perl
use strict;
use Getopt::Std;
use Mail::Sender;
use vars qw($opt_d $opt_m $opt_f $opt_s);
getopts('d:m:f:s:');
my $sender = new Mail::Sender {
        smtp => 'mail.selboo.com.cn',
        from => 'root@selboo.com.cn',
        auth => 'LOGIN',
        authid => 'root@selboo.com.cn',
        authpwd => '1234567890',
        on_errors => undef,
} or die "$Mail::Sender::Error\n";
$sender->MailFile({
        to => $opt_d,
        subject => $opt_s,
        msg => $opt_m,
        file => $opt_f
}) or die "$Mail::Sender::Error
Usage: $0 -d mailaddress -m mailmessage -s subject -f filename\n";
$sender -> Close();


使用方法
[root@jishu localhost]$ ./smail
No message specified
Usage: /usr/bin/smail -d mailaddress -m mailmessage -s subject -f filename



但是不支持html邮件,

支持html邮件 http://selboo.com.cn/post/626/
最后编辑: selboo 编辑于2011/09/03 01:58
Tags: ,
,
发表评论
表情
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]