SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    May 2011
    Posts
    242
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    How to configure phpmailer

    Hi guys,

    I had my website in a certain hosting and used mail() for the contact us page.
    I changed hosting and the new one is asking me to use phpmailer instead of mail().
    I am using Google as e-mail server.

    He sent me a RAR package with three files:
    - class.phpmailer.php
    - class.smtp.php
    - index.php

    He said I have lo see index.php to check how this function works. Here the code of this file:

    <?php
    require_once("class.phpmailer.php");
    //include("class.smtp.php");
    $mail = new PHPMailer();
    $mail->IsSMTP(); //Establece que el correo para enviar el mensaje a es través de SMTP, Si se establece en true, otras opciones también están disponibles. (verdadero, falso o en blanco)
    $mail->SMTPAuth = true; // True para que verifique autentificación de la cuenta o de lo contrario False
    //$mail->SMTPSecure = "ssl";
    $mail->Host = "mail.ppservicios.cl";///* Sustituye (ServidorDeCorreoSMTP) por el host de tu servidor de correo SMTP*/
    $mail->Port = 25;//puerto***
    $mail->Username = "a@ppservicios.cl";
    $mail->Password = "123456";

    $mail->From = "a@ppservicios.cl";
    $mail->FromName = "prueba";
    $mail->Subject = "prueba";
    $mail->cuerpo = "esto es una prueba";
    $mail->AddAddress("correo@dominio.com","Nombre a mostrar del Destinatario");

    $mail->WordWrap = 50;

    $body = "Hola, este es un…";
    $mail->IsHTML(true);//Para indicar si el mensaje contiene HTML:
    $mail->Body = $body;
    $mail->Send();
    // Notificamos al usuario del estado del mensaje

    if(!$mail->Send()) {
    echo "Error: " . $mail->ErrorInfo;
    } else {
    echo "Mensaje enviado correctamente";
    }
    ?>


    I have unsuccessfully tried to make this function works.

    Could you please let me know how to configure this file, and also how to use the other two files?
    Where should I save them and how should I call this function from my website?

    Thanks a lot!!!

  2. #2
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,438
    Mentioned
    82 Post(s)
    Tagged
    3 Thread(s)
    Checking out Google I found the home page for phpmailer at http://code.google.com/a/apache-extr...PHPMailer?tm=6
    There are some links to tutorials there.

    Also loads of other links including this one for gmail: http://www.web-development-blog.com/...ler-and-gmail/


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •