SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    May 2011
    1 Post(s)
    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:

    $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 = "";///* Sustituye (ServidorDeCorreoSMTP) por el host de tu servidor de correo SMTP*/
    $mail->Port = 25;//puerto***
    $mail->Username = "";
    $mail->Password = "123456";

    $mail->From = "";
    $mail->FromName = "prueba";
    $mail->Subject = "prueba";
    $mail->cuerpo = "esto es una prueba";
    $mail->AddAddress("","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;
    // 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
    Cambridge, England
    82 Post(s)
    3 Thread(s)
    Checking out Google I found the home page for phpmailer at
    There are some links to tutorials there.

    Also loads of other links including this one for gmail:


Posting Permissions

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