我已经在环境变量中设置了我的邮件服务器配置
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=25
MAIL_USERNAME=xxxxxxxx
MAIL_PASSWORD=xxxxxxxx
MAIL_ENCRYPTION=null
在我的本地服务器上,它运行良好。但是当我在生产服务器上测试它时,它就不能正常工作了。 我还尝试修改iptables以允许端口连接
# Generated by iptables-save v1.4.18 on Fri Feb 19 14:47:25 2016
*filter
:INPUT ACCEPT [72:5432]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [53:7392]
-A INPUT -p tcp -m tcp --dport 25 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 110 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 995 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 143 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 993 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 1080 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 1025 -j ACCEPT
COMMIT
但没有起到作用。每次我尝试发送测试邮件时,它仍然显示“连接未建立”。
然后我尝试使用telnet,但超时了。
[root@root laravel5]# telnet mailtrap.io 25
Trying 52.20.34.166...
telnet: connect to address 52.20.34.166: Connection timed out
Trying 52.22.93.185...
telnet: connect to address 52.22.93.185: Connection timed out
Trying 52.5.202.66...
telnet: connect to address 52.5.202.66: Connection timed out
什么可能导致这种情况?有人能帮我吗?非常感谢。