我的网络服务器的 php 错误日志中没有收到任何错误日志。我尝试过多个不同的 SMTP 服务器(我知道的其他电子邮件提供商也可以使用)。这是我的 HTML 表单:
这是我的 mailfunction.php,它在公共 html 之外调用我的邮件程序函数。
这是我的邮件功能。
isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = '[REDACTED]';
$mail->Password = '[REDACTED]';
$mail->SMTPSecure = 'SSL';
$mail->Port = 465;
$mail->setFrom('[REDACTED]');
$mail->addAddress('[REDACTED]');
$mail->isHTML(true);
$mail->Subject = 'Message Received (Contact Page)';
$mail->Body = 'Name : $name
Email: $email
Message : $message
';
$mail->send();
echo 'Message has been sent';
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
}
}
?>
没有消息被发送。这里可能有什么问题? 谢谢。
错误: 2022-07-07 01:16:57 SMTP 错误:无法连接到服务器:连接被拒绝 (111) SMTP 连接()失败。 https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号