[英]Connection to SMTP server via PHPMailer
我对PHPMailer有一些问题-它无法连接到SMTP服务器。 我使用以下设置:
$mail->Host = "mail.site.com";
$mail->SMTPAuth = true;
$mail->Port = 26;
$mail->Username = "test@site.com";
$mail->Password = "***";
当我尝试连接时-我收到错误“ SMTP错误:无法连接到SMTP主机”。 我也尝试设置:
$mail->SMTPSecure = 'ssl';
OR
$mail->SMTPSecure = 'tls';
但是错误仍然存在。
在我的电子邮件客户端(Thunderbird)中具有以下设置:
Server - mail.site.com
Port - 26
Secure Connection - STARTTLS
Username - test@site.com
我连接成功,可以发送/接收电子邮件。 也通过telnet mail.site.com 26我成功连接。
为什么使用相同的设置我无法连接到服务器?
首先,您应该阅读文档 。 确定要连接到端口26吗? SMTP通常在端口25(入站)上运行,并且通常应在端口587上使用tls发送。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.