How can exceptions be configured in PHP Mailer to handle errors more effectively during email sending processes?

When sending emails using PHP Mailer, exceptions can be configured to handle errors more effectively by setting the `exceptions` property to `true`. This will allow you to catch and handle any errors that occur during the email sending process, such as connection issues or invalid email addresses.

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

$mail = new PHPMailer(true);

try {
    // Set up the PHPMailer configuration
    
    $mail->exceptions = true; // Enable exceptions handling
    
    // Send the email
    $mail->send();
    
    echo 'Email sent successfully';
} catch (Exception $e) {
    echo 'Email could not be sent. Error: ' . $mail->ErrorInfo;
}