- 论坛徽章:
- 0
|
我用以下代码发邮件,出现奇怪错误,以前都是正常的,麻烦各位帮忙看看,谢谢!
#!/usr/bin/perl
use Net::SMTP;
my $mailhost = "smtp.163.com"; # the smtp host
my $mailfrom = [email=]'from@163.com'[/email]; # your email address
my @mailto = ([email=]'to@qq.com'[/email]); # the recipient list
my $subject = "此为标题";
my $text = "此为正文\n第二行位于此。";
my $smtp = Net::SMTP->new($mailhost, Hello => 'localhost', Timeout => 120, Debug => 1);
# 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; |
DEBUG出来结果如下:
Net::SMTP>>> Net::SMTP(2.31)
Net::SMTP>>> Net::Cmd(2.29)
Net::SMTP>>> Exporter(5.62)
Net::SMTP>>> IO::Socket::INET(1.31)
Net::SMTP>>> IO::Socket(1.30_01)
Net::SMTP>>> IO::Handle(1.27)
Net::SMTP=GLOB(0x183631c)<<< 220 163.com Anti-spam GT for Coremail System (163co
m[20081010])
Net::SMTP=GLOB(0x183631c)>>> EHLO localhost
Net::SMTP=GLOB(0x183631c)<<< 250-mail
Net::SMTP=GLOB(0x183631c)<<< 250-PIPELINING
Net::SMTP=GLOB(0x183631c)<<< 250-AUTH LOGIN PLAIN
Net::SMTP=GLOB(0x183631c)<<< 250-AUTH=LOGIN PLAIN
Net::SMTP=GLOB(0x183631c)<<< 250 8BITMIME
Net::SMTP=GLOB(0x183631c)>>> MAIL FROM:<from@163.com>
Net::SMTP=GLOB(0x183631c)<<< 553 authentication is required,smtp10,DsCowLCLvwBqt
0VKfc3kKw--.28997S2 1246082922
Net::SMTP=GLOB(0x183631c)>>> RCPT TO:<to@qq.com>
Net::SMTP=GLOB(0x183631c)<<< 503 bad sequence of commands
Net::SMTP=GLOB(0x183631c)>>> DATA
Net::SMTP=GLOB(0x183631c)<<< 503 bad sequence of commands
Net::SMTP=GLOB(0x183631c)>>> To: myxiangshi@qq.com
Net::SMTP=GLOB(0x183631c)>>> From: myxiangshi@163.com
Net::SMTP=GLOB(0x183631c)>>> Subject: 此为标题
Net::SMTP=GLOB(0x183631c)>>> 此为正文
Net::SMTP=GLOB(0x183631c)>>> 第二行位于此。
Net::SMTP=GLOB(0x183631c)>>> .
Net::SMTP=GLOB(0x183631c)<<< 502 Error: command not implemented
Net::SMTP=GLOB(0x183631c)>>> QUIT
Net::SMTP=GLOB(0x183631c)<<< 502 Error: command not implemented
我保证用户名和密码没错,请各位帮忙分析一下,谢谢!
[ 本帖最后由 小公猫 于 2009-6-27 14:19 编辑 ] |
|