0
我有以下代码:localhost连接使用Mail :: Sendmail的模块无法在Windows 10
#!C:\Perl\bin\perl.exe -w
use strict;
use warnings;
use Mail::Sendmail;
sendmail(
From => '[email protected]',
To => '[email protected]',
Subject => 'test email',
Message => "body of the message",
);
我得到以下错误:
Connect to localhost failed (An attempt was made to access a socket in a way forbidden by its access permissions.) no (more) retries!
我不知道如何纠正它,有什么想法?我使用的是Windows 10
指定SMTP服务器@戴夫我认为他们的意思是他们在Windows 10上运行该程序,而不是在Windows 10上运行。 – simbabque
除了应用命令行开关之外,在Perl代码中放置一行'#!'行是没有意义的。 Windows命令处理器会忽略它,并使用文件扩展名来确定要使用哪个程序来执行代码。既然你有'使用警告',那么也没有必要使用'-w',你可以完全删除第一行。 – Borodin