热门关键字:  ubuntu  分区  函数  Fedora  linux系统进程

当前位置 :| 主页>Linux教程>编程开发>Perl>

在Linux下,使用Perl发信邮件

来源: 作者: 时间:2007-12-03 Tag: 点击:


# anth login, type your user name and password here
$smtp->auth('user','pass'); ###用户名和密码

foreach my $mailto (@mailto) {
# Send the From and Recipient for the mail servers that require it
$smtp->mail($mailfrom);
$smtp->to($mailto);

# Start the mail
$smtp->data();

# Send the header
$smtp->datasend("To: $mailto\n");
$smtp->datasend("From: $mailfrom\n");
$smtp->datasend("Subject: $subject\n");
$smtp->datasend("\n");

# Send the message
$smtp->datasend("$text\n\n");

# Send the termination string
$smtp->dataend();
}
$smtp->quit;

6、给sendmail执行权限

  [root@CentOS ~]# chmod 755 /etc/init.d/sendmail.sh

7、测试

  [root@CentOS ~]# /etc/init.d/sendmail.sh

8、嘿嘿,看看信发送了没有。


上一页 1 2下一页
[收藏] [推荐] [评论] [打印] [关闭]
上一篇:curl+perl的自动分析程序
下一篇:用Perl动态建立ZIP压缩文件
最新评论共有 4 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册
栏目列表
热点关注
相关文章