Home > Backend Development > PHP Tutorial > When PHPMailer sends an email, the error message 'Could not connect to SMTP host' appears - PHP Tutorial

When PHPMailer sends an email, the error message 'Could not connect to SMTP host' appears - PHP Tutorial

WBOY
Release: 2016-07-15 13:21:25
Original
1129 people have browsed it


php PHPMailer is unable to connect to the host when sending emails. This is because the fsockopen function is disabled, and PHPmailer relies on this function to send emails.

Modify:


class.stmp.php


Solution:

1:


Line 118:


$this->smtp_conn = fsockopen($host, // the host of the server

changed to:

$this->smtp_conn = pfsockopen($host, // the host of the server


2:


File: class.phpmailer.php

Line 291:

public function IsSMTP() {
$this->Mailer = 'smtp';
}

changed to:


public function IsSMTP() {
$this->Mailer = 'SMTP';
}


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477185.htmlTechArticlephp PHPMailer is unable to connect to the host when sending emails. This is because the fsockopen function is disabled. PHPmailer relies on this function to send emails. . Modification: class.stmp.php Solution: 1: Line 118: ...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template