I'm trying to use PHPMailer for a small project, but I'm a bit confused about error handling with this software. When I've set up an email and I use:
$result = $mail->Send();
if(!$result) {
// There was an error
// Do some error handling things here
} else {
echo "Email successful";
}
Which works fine, more or less. The problem is when there's an error, PHPMailer also seems to echo the error out, so if there's a problem, it just sends that info directly to the browser, essentially breaking any error handling I"m trying to do.
Is there a way to silence these messages? Its not throwing an exception, its just printing out the error, which in my test case is:
invalid address: @invalid@email You must provide at least one recipient email address.
Its meant to be an error, but it should be residing in $mail->ErrorInfo; not being echo'd out by the software.