wp_mail function failing with PHP fatal error, no feedback or exception

[ad_1]

Hello, I’m trying to use wp_mail function and have some feedback in hostings that have PHP mail() function disabled.

If that’s the case when trying to execute wp_mail function, you’ll get a PHP:

Fatal error: Uncaught Error: Call to undefined function PHPMailer\PHPMailer\mail()

Is there a way to check, have some exception returned or some feedback when this function is not present?

Would be nice for any user using the wp_mail function to have an error message or simply detect it and show some feedback instead a PHP fatal error…

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer