Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function send() {
- Load::lib('phpmailer');
- $mail = new PHPMailer();
- $mail->From = $this->post('mymail');
- //Nombre del Remitente
- $mail->FromName = $this->post('myname');
- //Aqui le indicamos que vamos a utilizar un servidor smtp...
- $mail->Mailer = "smtp";
- //Aqui se le indica el servidor smtp
- $mail->SMTPDebug = 1;
- $mail->SMTPAuth = true;
- $mail->SMTPSecure = 'ssl';
- $mail->Host= 'smtp.gmail.com';
- $mail->Port = 465;
- //Le Indicamos el usuarios con el cual vamos a hacer la negociación de
- //identificación con el SMTP
- $mail->Username = "*";
- //Le indicamos la contraseña del servidor SMTP
- $mail->Password = "*";
- //establece el tiempo del servidor en Segundo
- $mail->Timeout=30;
- //Establece un asunto en el mensaje
- $mail->Subject= "Consulta web";
- //Añadiendo la Direccion de Correo electronico a la cual estara
- //dirigido el mensaje
- $mail->AddAddress("contactar@ccaballero.com");
- //Establecemos el cuerpo del mensaje en HTML
- $mybody = '<p>';
- $mybody .= '<br /><strong>Nombre:</strong>'.$_POST['myname'];
- $mybody .= '<br /><strong>Email:</strong>'.$_POST['myemail'];
- $mybody .= '<br /><strong>Consulta:</strong>'.$_POST['mymessage'];
- $mybody .= '</p>';
- $mail->Body=$mybody;
- //Aqui pasamos texto plano ya que algunos cliente no aceptan HTML
- $mail->AltBody = "Este ejemplo es para ver como funciona PHPmailer desde KUMBIA";
- //Enviamos el correo
- $exito = $mail->Send();
- $intentos = 1;
- //esto se realizara siempre y cuando la var exito contenga como valor false
- while ((!$exito) && $intentos < 5){
- $exito = $mail->Send();
- $intentos = $intentos +1;
- }
- // Anulamos la salida
- $this->render (NULL, NULL);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement