I’m using ajax call to send a message from my contact form. However, I want to print the server response back to user, if it succeeds or if it fails, and I want to report if class.phpmailer.php is missing for some reason, but this isn’t working for me, so how could I display a custom error message on require failure?
require "class.phpmailer.php"; or die("<span style='color:red;'>Tiedosto class.phpmailer.php puuttuu! Viestin lähetys epäonnistui!</span>");
You will need to check that the files exists first then do an import, if the file cannot be found then it will display your message back to the user.