Error sending email with PHPMAILER [closed]

0

Hello, follow the code:

Inicia a classe PHPMailer
$mail = new PHPMailer();


$mail->IsSMTP(); 
$mail->Host = "smtp.dominio.com"; 
$mail->Username = '[email protected]'; // Usuário do servidor SMTP
$mail->Password = 'senha123'; // Senha do servidor SMTP


$mail->From = "[email protected]"; 
$mail->FromName = "meu dominio"; 



$mail->AddAddress("meuemail","meunome");

$mail->IsHTML(true); 

$mail->Subject  = "Confirmação de pagamento";
$mail->Body = "meu email em html..";


$enviado = $mail->Send();


$mail->ClearAllRecipients();
$mail->ClearAttachments();


if ($enviado) {
echo "E-mail enviado com sucesso!";
} else {
echo "Não foi possível enviar o e-mail.<br /><br />";
echo "<b>Informações do erro:</b> <br />" . $mail->ErrorInfo;
}

Follow the error:

  

Could not send email.

     

Error information: SMTP connect () failed. Could not send   the email.

     

Error information: SMTP connect () failed.

Anyway, has this error occurred to anyone? And what was the reason? I already enabled the ssl line there in php.ini that I heard some say it needed ..

    
asked by anonymous 09.12.2014 / 21:40

1 answer

1

Change require('class.phpmailer.php'); to require('PHPMailerAutoload.php');

Do not forget to check if you have the PHPMailerAutoload.php file in the folder where you are calling PHPMailer

    
09.12.2014 / 21:43