SMTP电子邮件未发送(服务器配置有问题,因为其他服务器的代码正常)
问题描述:
我正在使用删除服务器的SMTP详细信息。这是代码片段。SMTP电子邮件未发送(服务器配置有问题,因为其他服务器的代码正常)
$mail = new PHPMailer;
$mail->IsSMTP(); // Set mailer to use SMTP
$mail->Host = isset($_GET['host'])?$_GET['host']:"[email protected]";
$mail->Port = isset($_GET['port'])?$_GET['port']:"465";
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = "[email protected]";
$mail->Password = "xxx";
$mail->SMTPSecure = 'ssl';
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => true,
'verify_peer_name' => true,
'allow_self_signed' => false
)
);
$mail->SMTPDebug=2;
答
尝试检查服务器上的SMTP限制。如果您使用的是共享主机,那么您可以联系您的主机提供商。 如果您有WHM访问权限,请尝试此操作。 WHM - >服务器配置 - >调整设置 - >安全 - >限制传出SMTP根,进出口,以及邮差(FKA SMTP调整)
关闭它 希望这将解决这个问题:)
完美!工作得很好:) – Alpi