免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1538 | 回复: 1
打印 上一主题 下一主题

perl发mail问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-12-24 12:51 |只看该作者 |倒序浏览
#!/usr/bin/perl -w
open(SENDMAIL, "|/usr/lib/sendmail -oi -t -odq")
                    or die "Can't fork for sendmail: $!\n";
print SENDMAIL <<"EOF";
From: User Originating Mail <root\@localhost>
To: Final Destination <postmaster\@localhost>
Subject: here is the subject
here is the body ,GOOD LUCK!!
EOF
close(SENDMAIL)     or warn "sendmail didn't close nicely";

maillog如下
Dec 14 13:33:49 centOS02 sendmail[5509]: mBEIXnom005509: from=root, size=149, class=0, nrcpts=1, msgid=<200812141833.mBEIXnom005509@centOS02>, relay=root@localhost
Dec 14 13:33:49 centOS02 sendmail[5509]: mBEIXnom005509: to=Final Destination <postmaster@localhost>, delay=00:00:00, mailer=relay, pri=30149, stat=queued


# mail
No mail for root
哪位指点一下

论坛徽章:
3
戌狗
日期:2014-09-10 17:07:162015年辞旧岁徽章
日期:2015-03-03 16:54:15wusuopu
日期:2016-06-17 17:43:45
2 [报告]
发表于 2008-12-24 13:52 |只看该作者
原帖由 bitterness 于 2008-12-24 12:51 发表
#!/usr/bin/perl -w
open(SENDMAIL, "|/usr/lib/sendmail -oi -t -odq")
                    or die "Can't fork for sendmail: $!\n";
print SENDMAIL  

我用你这个脚本可以收到邮件。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP