免费注册 查看新帖 |

Chinaunix

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

smtp发送mail问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-01-30 14:53 |只看该作者 |倒序浏览
刚接触perl不久,今天用smtp发送mail遇到下面问题,望大家指教,谢谢!

    my $smtp = Net::SMTP->new('mailhost');

    $smtp->mail('test@test.com');

出错信息Can't call method "mail" on an undefined value at XXXXX line XX

请问是何原因造成,该如何解决,谢谢!

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
2 [报告]
发表于 2007-01-30 14:59 |只看该作者
很明显是 new 失败了。

论坛徽章:
0
3 [报告]
发表于 2007-01-30 15:09 |只看该作者
flw,可以稍微详解释下么?
比如什么情况会造成new失败,谢谢~

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
4 [报告]
发表于 2007-01-30 15:16 |只看该作者
原帖由 golden_lee 于 2007-1-30 15:09 发表
flw,可以稍微详解释下么?
比如什么情况会造成new失败,谢谢~

比如没连上 SMTP Server

论坛徽章:
0
5 [报告]
发表于 2007-01-30 15:22 |只看该作者
大概明白了,我估计需要去检查.libnetrc 这个文件,看看smtp server的设置,谢谢!

论坛徽章:
0
6 [报告]
发表于 2007-01-30 17:24 |只看该作者
原帖由 golden_lee 于 2007-1-30 15:22 发表
大概明白了,我估计需要去检查.libnetrc 这个文件,看看smtp server的设置,谢谢!

           
Really?
perldoc Net::SMTP
CONSTRUCTOR
  new ( [ HOST ] [, OPTIONS ] )
    This is the constructor for a new Net::SMTP object. "HOST" is the
    name of the remote host to which an SMTP connection is required.

    "HOST" is optional. If "HOST" is not given then it may instead be
    passed as the "Host" option described below. If neither is given
    then the "SMTP_Hosts" specified in "Net::Config" will be used.
...


is 'mailhost' configured at your local?
otherwise simply say full qualified smtp hostname or its IP address
instead of 'mailhost'

--ulmer
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP