Perl MIME::Lite 错误的文件描述符
Perl MIME::Lite bad file descriptor
到目前为止,这是我的代码:
#!/usr/bin/perl
use strict;
use warnings;
use MIME::Lite;
my $to = 'example@asd.com';
my $from = 'example@asd.com';
my $subject = 'Test Email';
my $message = 'This is test email sent by Perl Script';
my $msg = MIME::Lite->new(
From => $from,
To => $to,
Subject => $subject,
Data => $message
);
$msg->add( "Type" => "multipart/mixed" );
$msg->send("smtp", "good.domain.net");
print "Email Sent Successfully\n";
当我想要 运行 脚本时,出现以下错误:
Failed to connect to mail server: Bad file descriptor at ...\email.pl
line 17.
我不知道问题出在哪里。有人知道如何解决这个问题吗?
编辑: 我更正了上面的代码,它正在使用正确的服务器(它根本不需要身份验证)。
MIME::Lite SMTP调试程序
尝试缩小问题的搜索范围。
1: telnet SMTP 主机时是否收到 SMTP 问候消息?
telnet mail.domain.net 25
1:YES => 添加调试选项到 MIME::Lite 发送(通过 SMTP)调用。
$msg->send("smtp", "mail.domain.net", Debug=>1, AuthUser=>'myname@domain.com', AuthPass=>"password" );
到目前为止,这是我的代码:
#!/usr/bin/perl
use strict;
use warnings;
use MIME::Lite;
my $to = 'example@asd.com';
my $from = 'example@asd.com';
my $subject = 'Test Email';
my $message = 'This is test email sent by Perl Script';
my $msg = MIME::Lite->new(
From => $from,
To => $to,
Subject => $subject,
Data => $message
);
$msg->add( "Type" => "multipart/mixed" );
$msg->send("smtp", "good.domain.net");
print "Email Sent Successfully\n";
当我想要 运行 脚本时,出现以下错误:
Failed to connect to mail server: Bad file descriptor at ...\email.pl line 17.
我不知道问题出在哪里。有人知道如何解决这个问题吗?
编辑: 我更正了上面的代码,它正在使用正确的服务器(它根本不需要身份验证)。
MIME::Lite SMTP调试程序
尝试缩小问题的搜索范围。
1: telnet SMTP 主机时是否收到 SMTP 问候消息?
telnet mail.domain.net 25
1:YES => 添加调试选项到 MIME::Lite 发送(通过 SMTP)调用。
$msg->send("smtp", "mail.domain.net", Debug=>1, AuthUser=>'myname@domain.com', AuthPass=>"password" );