Guest User

Untitled

a guest
Dec 24th, 2017
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.11 KB | None | 0 0
  1. Load::lib('phpmailer');
  2.  
  3. class Email extends PHPMailer {
  4.  
  5.     public function enviar($datos) {
  6.         if (!filter_var($datos['email'], FILTER_VALIDATE_EMAIL)) {
  7.             return 'El email de tu amigo(a) es incorrecto';
  8.         }
  9.         if(isset($datos['emailUsuario'])) {
  10.             if (!filter_var($datos['emailUsuario'], FILTER_VALIDATE_EMAIL)) {
  11.                 return "Su e-mail es incorrecto";
  12.             }
  13.         }
  14.         $this->IsSMTP();
  15.         $this->SMTPAuth = true;
  16.         $this->SMTPSecure = "ssl";
  17.         $this->Host = "smtp.gmail.com";
  18.         $this->Port = 465;
  19.         $this->Username = $datos['usuario'];
  20.         $this->Password = $datos['pasword'];
  21.         $this->From = $datos['usuario'];
  22.         $this->FromName = "DescargaTuMp3";
  23.         $this->Subject = $datos['tituloMensaje'];
  24.         $this->MsgHTML($datos['mensajeHtml']);
  25.         $this->AddAddress($datos['email'], $datos['namea']);
  26.         $this->IsHTML(true);
  27.         if (!$this->Send()) {
  28.             return "<b>Error:" . $this->ErrorInfo . "</b><br/>";
  29.         }
  30.         else
  31.             return false;
  32.     }
  33.  
  34. }
Add Comment
Please, Sign In to add comment