Configure PHPMAILER 6.0.1

0

Well, I was using phpmailer 5.x.x to send emails (using gmail) through my site. It worked perfectly. We recently suffered some attacks due to security issues with this release. So I need to upgrade to version 6.

I can not find anything to help me configure the server properly. All tutorials I think are for earlier versions. Can anyone help me?

    
asked by anonymous 01.10.2017 / 06:47

1 answer

1

This is the latest version of PHPMailer , released September 14, documentation is available in English, there are also some examples available in the repository at github , where you will find two examples of how to integrate with Gmail .

$mail = new PHPMailer();
// Define os dados do servidor e tipo de conexão
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
$mail->IsSMTP(true); // Define que a mensagem será SMTP
$mail->Host = "smtp.gmail.com"; // Endereço do servidor SMTP
$mail->Port = 587;
$mail->SMTPAuth = true; // Usa autenticação SMTP? (opcional)
$mail->SMTPSecure = 'tls';
$mail->Username = '[email protected]'; // Usuário do servidor SMTP
$mail->Password = 'minhasenha'; // Senha do servidor SMTP

$mail->isHTML(true);
$mail->Subject  = "Mensagem Teste"; // Assunto da mensagem
$mail->Body = "Este é o corpo da mensagem de teste, em <b>HTML</b>!  :)";
$mail->AltBody = "Este é o corpo da mensagem de teste, em Texto Plano! \r\n :)";

// Envie a mensagem, verifica se há erros
if (!$mail->send()) {
    echo "Erro do Mailer: " . $mail->ErrorInfo;
} else {
    echo "Mensagem enviada!";
}
  

Read also Upgrading from PHPMailer 5.2 to 6.0 in English

    
01.10.2017 / 07:37