При попытке сделать регистрацию в игре, происходит ошибка: Warning: require_once(phpmailer/PHPMailer.php): Failed to open stream: No such file or directory in /srv/disk5/php/bl_Mailer.php on line 5
Fatal error: Uncaught Error: Failed opening required 'phpmailer/PHPMailer.php' (include_path='.:/usr/local/php-8.2.18/share/pear') in /srv/disk5/php/bl_Mailer.php:5
Stack trace:
#0 /srv/disk5/php/bl_Register.php(9): include_once()
#1 {main}
thrown in /srv/disk5/php/bl_Mailer.php on line 5
А так же точно такая же ошибка только Unknown error:
Пробовал менять несколько раз скрипт, ничего не помогло, что может быть?
Я первый раз делаю что-то подобное на PHP, раньше с бд и прочими вещами не связывался!
<?php
require_once('bl_Common.php');
require_once('phpmailer/PHPMailer.php');
require_once('phpmailer/SMTP.php');
require_once('phpmailer/POP3.php');
require_once('phpmailer/Exception.php');
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
const IS_SMTP = false; // Set to true if you want to use SMTP Authentication
const SMTP_HOST = "SMTP_HOST_HERE";
const SMTP_PORT = 587;
const USE_TTLS = false;
const SMTP_USER = "admin@example.com";
const SMTP_PASSWORD = "SMTP_MAIL_PASSWORD_HERE";
class MailCreator
{
public function Send($from, $to, $subject, $message)
{
if (IS_SMTP) {
try {
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->CharSet = "UTF-8";
$mail->Debugoutput = 'html';
$mail->Host = SMTP_HOST;
$mail->Port = SMTP_PORT;
if (USE_TTLS == true) {
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
} else {
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
}
$mail->IsHTML(true);
$mail->Username = SMTP_USER;
$mail->Password = SMTP_PASSWORD;
$mail->From = $from;
$mail->FromName = GAME_NAME;
$mail->AddAddress($to);
$mail->AddReplyTo($from, GAME_NAME);
$mail->Subject = $subject;
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
$mail->Body = $message;
if (!$mail->Send()) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
return false;
} else {
return true;
}
}
catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
return false;
}
} else {
// Basic PHP mail() function
$headers = "From:" . $from . "\r\n";
$headers .= "Reply-To: " . $from . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
if (mail($to, $subject, $message, $headers)) {
return true;
} else {
return false;
}
}
}
}
?>
using (UnityWebRequest www = UnityWebRequest.Post(GetURL(bl_LoginProDataBase.URLType.Register), mForm))
{
yield return www.SendWebRequest();
if (www.error == null)
{
string result = www.downloadHandler.text;
if (bl_LoginProDataBase.Instance.FullLogs)
{
Debug.Log("Register Result: " + result);
}
if (result.Contains("success") == true)
{
//show success
ChangePanel(4);
SetLogText("Register success!");
}
else
{
//Debug.Log(www.downloadHandler.text);
ErrorType(www.downloadHandler.text);
}
}
else
{
Debug.Log("Error:" + www.error);
}
LoadingUI.SetActive(false);
}
isRequesting = false;
}