[PerlChina] 答复: send mail in windows VISTA

Bruce Cheng bruce1914 at gmail.com
Wed Feb 13 04:49:06 PST 2008


我的代码是这样写的:

 

#! c:/perl/bin/perl.exe

 

use Net::SMTP ;

 

$smtp = Net::SMTP->new('smtp.gmail.com') or die "Error1 : $!\n" ;

 

print $smtp->domain ;

 

$smtp->auth('username', 'password')  or die "Error2 : $!\n";

$smtp->mail('bruce1914 at gmail.com')  or die "Error3 : $!\n";

$smtp->to('bruce1985cx at 163.com')  or die "Error4 : $!\n";

$smtp->data() ;

 

print $smtp ;

 

$smtp->datasend("To: bruce1985cx at 163.com\n") or die "Error5 : $!\n" ;

$smtp->datasend("\n") ;

$smtp->datasend("A simple test message\n") or die "Error 6: $!\n" ;

$smtp->dataend()  or die "Error7 : $!\n";

 

$smtp->quit ;

 

运行结果:

 

  Error2 : No such file or directory

  mx.google.com

 

我试了很多网上别人提供的代码都不行,不知道哪儿有问题。

 

发件人: china-pm-bounces+bruce1914=gmail.com at pm.org
[mailto:china-pm-bounces+bruce1914=gmail.com at pm.org] 代表 Prince Brave
发送时间: 2008年2月13日 4:02
收件人: china-pm at pm.org
主题: Re: [PerlChina] send mail in windows VISTA

 

你可以使用perl Net::SMTP模块来实现
Bruce Cheng 写道: 

在Windows Vista 下面怎么用perl发邮件,我希望我的电脑自动每隔一 段时间发一个
指定的附件到一个地址。

 

 

Bruce

 





  _____  



 
_______________________________________________
China-pm mailing list
China-pm at pm.org
http://mail.pm.org/mailman/listinfo/china-pm

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/china-pm/attachments/20080213/fd1a2a32/attachment.html 


More information about the China-pm mailing list