1

I have this error in my hostfinger domain:

Fatal error: Call to undefined method stdClass::Send() in /home/u111308831/public_html/index.php on line 26

This is my code:

<?php
//require_once('class.phpmailer.php');
require("PHPMailerAutoload.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->CharSet = "UTF-8";
$mail->SMTPSecure = 'ssl';
$mail­->SMTPAuth = true;
$mail->Host = 'smtp.gmail.com';
$mail­->Port = 587;

$mail->From = 'sender@gmail.com';
$mail->FromName = 'Sender name';
$mail->AddReplyTo('sender@gmail.com', 'sender name');
$mail->IsHTML(true);
$mail­->Subject = "Respuestas de Pepito";
$mail->AltBody = "To view the message, please use an HTML compatible      email viewer!";
$mail->Body = "Hello";
$mail->AddAddress('receiver@gmail.com', 'receiver');

$mail­->Password = 'sender pass';
$mail->Username = 'sender@gmail.com';


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

This is my line 26: if(!$mail­->Send()) {

Do anyone knows what the problem could be? Thanks.

  • Working example here http://stackoverflow.com/questions/16048347/send-email-using-gmail-smtp-server-through-php-mailer/16048485#16048485 – andrew-caulfield Feb 24 '15 at 22:39
  • Thanks. I have changed the SMTPSecure to ssl. It was the only difference between this code and mine, but I have the same error. Thanks for the comment anyway. – Luis Garcia Fernandez Feb 27 '15 at 12:06

1 Answers1

1

I think that maybe you are requiring the wrong file.

Try:

require("PHPMailerAutoload.php");
Patrick Bard
  • 1,777
  • 17
  • 40