This code only seems to work. In case you have a negative response from the server, eg. $smtp->response() will still return ok