Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Load::lib('phpmailer');
- class Email extends PHPMailer {
- public function enviar($datos) {
- if (!filter_var($datos['email'], FILTER_VALIDATE_EMAIL)) {
- return 'El email de tu amigo(a) es incorrecto';
- }
- if(isset($datos['emailUsuario'])) {
- if (!filter_var($datos['emailUsuario'], FILTER_VALIDATE_EMAIL)) {
- return "Su e-mail es incorrecto";
- }
- }
- $this->IsSMTP();
- $this->SMTPAuth = true;
- $this->SMTPSecure = "ssl";
- $this->Host = "smtp.gmail.com";
- $this->Port = 465;
- $this->Username = $datos['usuario'];
- $this->Password = $datos['pasword'];
- $this->From = $datos['usuario'];
- $this->FromName = "DescargaTuMp3";
- $this->Subject = $datos['tituloMensaje'];
- $this->MsgHTML($datos['mensajeHtml']);
- $this->AddAddress($datos['email'], $datos['namea']);
- $this->IsHTML(true);
- if (!$this->Send()) {
- return "<b>Error:" . $this->ErrorInfo . "</b><br/>";
- }
- else
- return false;
- }
- }
Add Comment
Please, Sign In to add comment