Is there a way to console.log my response php mailer

Yes, you can use the error_log function in PHP to log the response of the PHPMailer class. Here's an example:

<?php
require 'PHPMailer/PHPMailer.php';
require 'PHPMailer/SMTP.php';

$mail = new PHPMailer\PHPMailer\PHPMailer();
$mail->isSMTP();
$mail->Host = 'smtp.example.com';
$mail->Port = 587;
$mail->SMTPAuth = true;
$mail->Username = '[email protected]';
$mail->Password = 'your_password';

$mail->setFrom('[email protected]', 'Your Name');
$mail->addAddress('[email protected]', 'Recipient Name');

$mail->Subject = 'Test Email';
$mail->Body = 'This is a test email';

if (!$mail->send()) {
    error_log('Error sending email: '. $mail->ErrorInfo);
    echo 'Error sending email: '. $mail->ErrorInfo;
} else {
    error_log('Email sent successfully');
    echo 'Email sent successfully';
}
?>

In this example, if the email is not sent successfully, the error_log function will log the error message to the server's error log file. You can also use the echo statement to display the error message in the browser.

Alternatively, you can use the debug option when creating the PHPMailer object to enable debug mode. This will output the email sending process to the browser:

$mail = new PHPMailer\PHPMailer\PHPMailer(true); // Enable debug mode

This will output the email sending process to the browser, including any errors that may occur.

You can also use the SMTPDebug option to enable SMTP debug mode, which will output the SMTP conversation to the browser:

$mail->SMTPDebug = 2; // Enable SMTP debug mode

This will output the SMTP conversation, including the commands sent to the SMTP server and the responses received from the server.