- 论坛徽章:
- 0
|
以下是我的脚本内容,请问个位高手
为啥运行后报: can't call method "auth" on an undefined value at line 14
请教啥问题? 我的邮箱:yesir650@hotmail.com 电话:13918741337
#!/usr/bin/perl -w
use strict;
use Net::SMTP;
my $to = '1184013290@qq.com';
my $from = 'yesir650@126.com';
my $site = 'mail.126.com';
my $smtp_host = 'smtp.126.com';
my $pop_host = 'pop3.126.com';
my $username = "yesir650";
my $password = "8636714";
&writeAMesg;
sub writeAMesg{
my $smtp = Net::SMTP->new( $smtp_host, Timeout=>60, Debug=>1 );
$smtp->auth($username, $password);
$smtp->mail( $from );
$smtp->to( $to );
$smtp->data();
$smtp->datasend("To: $to\n");
$smtp->datasend("Subject: A message from server\n");
$smtp->datasend("\n");
$smtp->datasend("This is just to let you know\n");
$smtp->datasend("The flight is coming, Please check it out on time.\n");
$smtp->datasend("\n");
$smtp->dataend();
$smtp->quit;
}
|
|