我的新托管公司有问题。我无法通过端口465发送电子邮件。正如您所知,端口465用于安全SMTP服务,如果关闭,用户将无法从外部电子邮件帐户(如Yahoo!或Gmail。例如,当我试图通过PHPMailer发送电子邮件时,我收到了以下错误:
Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
现在我的问题是如何检查Cpanel中的端口465是否关闭?我使用http://portquiz.net/网站,并显示端口465被阻止。什么是最简单的方法来证明托管公司他们封锁了465端口。谢谢
如果您的服务提供商使用CSF防火墙,则默认情况下始终处于阻止状态,因此您应联系服务提供商以从阻止列表中删除。
您可以使用下面的php脚本扫描所有邮件端口。
<?php
$ports[] = array('host'=>'interspire.smtp.com','number'=>25);
$ports[] = array('host'=>'interspire.smtp.com','number'=>2525);
$ports[] = array('host'=>'interspire.smtp.com','number'=>25025);
$ports[] = array('host'=>'helpme.interspire.smtp.com','number'=>80);
$ports[] = array('host'=>'google.com','number'=>80);
$ports[] = array('host'=>'smtp.gmail.com','number'=>587);
$ports[] = array('host'=>'smtp.gmail.com','number'=>465);
$ports[] = array('host'=>'pop.gmail.com','number'=>995);
$ports[] = array('host'=>'imap.gmail.com','number'=>993);
$ports[] = array('host'=>'ftp.mozilla.org','number'=>21);
$ports[] = array('host'=>'smtp2go.com','number'=>8025);
$ports[] = array('host'=>'relay.dnsexit.com','number'=>25);
$ports[] = array('host'=>'relay.dnsexit.com','number'=>26);
$ports[] = array('host'=>'relay.dnsexit.com','number'=>940);
$ports[] = array('host'=>'relay.dnsexit.com','number'=>8001);
$ports[] = array('host'=>'relay.dnsexit.com','number'=>2525);
$ports[] = array('host'=>'relay.dnsexit.com','number'=>80);
$ports[] = array('host'=>'mail.authsmtp.com','number'=>23);
$ports[] = array('host'=>'mail.authsmtp.com','number'=>25);
$ports[] = array('host'=>'mail.authsmtp.com','number'=>26);
$ports[] = array('host'=>'mail.authsmtp.com','number'=>2525);
foreach ($ports as $port)
{
//$connection = @fsockopen($port['host'], $port['number']);
$connection = @fsockopen($port['host'], $port['number'], $errno, $errstr, 5); // 5 second timeout for each port.
if (is_resource($connection))
{
echo '<h2>' . $port['host'] . ':' . $port['number'] . ' ' . '(' . getservbyport($port, 'tcp') . ') is open.</h2>' . "n";
fclose($connection);
}
else
{
echo '<h2>' . $port['host'] . ':' . $port['number'] . ' is not responding.</h2>' . "n";
}
}
?>
由interwire 编写的代码
要检查您的Cpanel服务器上是否有端口被防火墙关闭,请尝试以下操作:
iptables -L -n |grep [PORT]
# For your question
iptables -L -n |grep 465
端口465 SMTP 无效