Are there alternative classes or libraries recommended for sending emails via SMTP in PHP if PHPMailer is not working as expected?

If PHPMailer is not working as expected for sending emails via SMTP in PHP, an alternative option is to use the built-in `mail()` function in PHP. This function allows you to send emails without relying on an external library like PHPMailer.

$to = "recipient@example.com";
$subject = "Test Email";
$message = "This is a test email sent using the mail() function in PHP.";
$headers = "From: sender@example.com";

if (mail($to, $subject, $message, $headers)) {
    echo "Email sent successfully!";
} else {
    echo "Email sending failed.";
}