Не удаётся отправить письмо phpmailer
Пытаюсь отправить обычное письмо из примера phpmailer, но выдаёт ошибку Message could not be sent. Mailer Error: Could not instantiate mail function.
Вот код, в котором появилась ошибка:
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
//require 'vendor/autoload.php';
require 'PHPMailer/src/Exception.php';
require 'PHPMailer/src/PHPMailer.php';
$mail = new PHPMailer(true);
try{
//Recipients
$mail->setFrom('[email protected]', 'Mailer');
$mail->addAddress('[email protected]');
//Content
$mail->isHTML(true); //Set email format to HTML
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
$mail->send();
echo 'Message has been sent';
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
Если кто-то сталкивался с подобным и знает решение, просьба написать его сюда. Буду признателен..)