以下は私のPHPの電子メールコードです。SMTP - >エラー:サーバーへの接続に失敗しました:PHPマリアの(0)
require_once('_lib/class.phpmailer.php');
include 'func/db_connect.php';
error_reporting(E_ALL);
ini_set('display_errors', 1);
function supervisorMail(){
global $error;
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 2;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->Username = "*****@gmail.com";
$mail->Password = "*****";
$mail->SetFrom("****@gmail.com", "Employee Leave Management System");
}
しかし、コードを変更しなければ動作しないため、次のエラーが発生します。
SMTP -> ERROR: Failed to connect to server: (0) SMTP Error: Could not connect to SMTP host. Message could not be sent. Mailer Error: SMTP Error: Could not connect to SMTP host.
私は解決策を見つけることができませんでした。どうしたらいいですか?
私はextension = php_openssl.dllを有効にしていますが、MTPDebugも1にしています。でも、まだ動作しません。 – Chathurika
サーバを再起動しましたか? –