$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch