我的新托管公司有问题。我无法通过端口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的最简单方法。 感谢。
答案 0 :(得分:0)
要检查您的Cpanel服务器是否已通过防火墙关闭端口,请尝试以下命令:
iptables -L -n |grep [PORT]
# For your question
iptables -L -n |grep 465
Port 465 unoficial for SMTP
答案 1 :(得分:0)
如果您的服务提供商使用 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";
}
}
?>
撰写的代码