$errores_msg = ''; error_reporting(-1); //captura todos los tipos de errores ... foreach ($res2->datos as $d) { $correo = new CorreoExterno(); try { if (isset($d['email_empresa'])) { $correo->addDestinatario($d['email_empresa'], $d['email_empresa']); //$correo->addCC($_SESSION["_MAIL_PRUEBAS"],'Correo de Pruebas'); if ($d['acceso_directo'] != '' && $d['acceso_directo'] != NULL) { $correo->setAccesoDirecto($d['id_alarma']); } if (!PHPMailer::validateAddress($d['email_empresa'])) { throw new phpmailerException("Email address " . $d['email_empresa'] . " is invalid -- aborting!"); } if (!$correo->validateEmail($d['email_empresa'])) { throw new phpmailerException("Domain Email address " . $d['email_empresa'] . " is invalid -- aborting!"); } } else { if (isset($d['correos'])) { $correos = explode(',', $d['correos']); foreach ($correos as $value) { echo 'ssss <br>'; echo $value; echo '--------'; $value = trim($value); $correo->addDestinatario($value, $value); if (!PHPMailer::validateAddress($value)) { throw new phpmailerException("Email address " . $value . " is invalid -- aborting!"); } if (!$correo->validateEmail($value)) {