I am currently making a website.
And I would like to give users the opportunity to send emails here. But I have a problem that I can’t solve. I wrote the following program for email.
use PHPMailerPHPMailerPHPMailer;
require ’r/src/Exception.php';
require r/src/PHPMailer.php';
require r/src/SMTP.php';
$mail = new PHPMailer();
$mail->isSMTP();
$mail->Host = ’*;
$mail->SMTPAuth = true;
$mail->Username = *;
$mail->Password = *;
$mail->SMTPSecure = 'tls';
$mail->Port = 465;
$mail->setFrom(*, 'First Last');
$mail->addAddress(*, 'First Last');
$mail->Subject = 'PHPMailer mail() test';
$mail->isHTML(TRUE);
$mail->Body = 'html>';
if(!$mail->send()){
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
But the $mail->send() function never executes. It does not return an error, but the program stops here.
Does anyone have any idea what the problem could be?
I tried to run the program with the debugger, but it keeps getting stuck at the mail.send line.
New contributor
splmn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.