Configure PHPMAILER 6.0.1

Asked

Viewed 1,296 times

0

Guys, 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 of this version. So I need to upgrade to version 6.

I can’t find anything to help me set up the server properly. All tutorials I think are for previous versions. I wonder if someone could help me?

1 answer

1

This is the latest version of Phpmailer, launched on 14 September, the documentation is available in English, there are also some examples available in the 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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.