小编kye*_*osh的帖子

在centos上为smtp打开465端口的问题

我正在使用phpMailer发送使用谷歌应用程序地址/smtp 的购买确认。整个过程在开发盒上运行良好,但现在它已经上线,似乎我使用的端口 (465) 被阻止了。

所以我编辑iptables:

-A INPUT -p tcp -dport 465 -j ACCEPT  
-A INPUT -p tcp -sport 465 -j ACCEPT
Run Code Online (Sandbox Code Playgroud)

我的理解是,这允许 465 上的入站和出站连接(如果我错了,请纠正我)。重启iptables后:

iptables -nL  
Chain INPUT (policy ACCEPT)
target   prot   opt   source      destination
ACCEPT   tcp    --    0.0.0.0/0   0.0.0.0/0   tcp dpt:465
ACCEPT   tcp    --    0.0.0.0/0   0.0.0.0/0   tcp spt:465
Run Code Online (Sandbox Code Playgroud)

但是我仍然收到“无法连接到服务器:权限被拒绝”作为来自 phpMailer 的调试。从我读到的内容来看,这通常表明端口已关闭,显然情况确实如此。

关于如何进一步调试的任何提示?任何帮助将非常感激。

如果有帮助,这里是 php:

$mail = new PHPMailer();        
$mail->IsSMTP();
$mail->SMTPDebug = 1; //!DEV
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';      
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465; …
Run Code Online (Sandbox Code Playgroud)

smtp iptables centos

3
推荐指数
1
解决办法
8881
查看次数

标签 统计

centos ×1

iptables ×1

smtp ×1