Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function validaServidorEmail($SsSMTPserver, $SsSMTPport, $SsEmail, $SsNome) {
- gravarLog("classe/EmailService -> validaServidorEmail");
- error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
- include_once "Net/SMTP.php";
- /* Create a new Net_SMTP object. */
- if (!($smtp = new Net_SMTP('smtp.gmail.com','587'))) {
- return ['status' => false, 'msg' => "Error: Unable to instantiate Net_SMTP object"];
- }
- // $e = $smtp->connect();
- if (PEAR::isError($e = $smtp->connect())) {
- gravarLog($e->getMessage());
- return ['status' => false, 'msg' => $e->getMessage()];
- }
- if (PEAR::isError($smtp->auth('lpaivtestex@gmail.com', 'xxxxxxxxxx'))) {
- return ['status' => false, 'msg' => "unable to authenticate to smtp server"];
- }
- $smtp->disconnect();
- return ['status' => true, 'msg' => 'Conexão ok'];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement