Pessoal, fiz o tese com o gmail e funciona normalmente, porém com o php mailler não funciona. a aplicação retorna que foi enviado porém a mensagem nunca chega.
meu código está assim..
<?php
require './Library/Mailer/PHPMailerException.php';
require './Library/Mailer/SMTP.php';
require './Library/Mailer/PHPMailer.php';
$dados_form = filter_input_array(INPUT_POST, FILTER_DEFAULT);
if (isset($dados_form['nome'])):
$mail = new App\Library\Mailer\PHPMailer();
try {
$mail->SMTPOptions = [
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
]
];
$mail->isSMTP();
// $mail->SMTPDebug = 3;/*Debug*/
$mail->Host = 'smtp.leonesystems.com.br';
$mail->SMTPAuth = true;
$mail->Username = '[email removido]';
$mail->Password = '********';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->setFrom($dados_form['email'], $dados_form['nome']);/*opcional*/
$mail->addAddress('[email removido]', 'Novo Contato');
$mail->addReplyTo($dados_form['email'], $dados_form['nome']);
// $mail->addCC('[email removido]');
// $mail->addBCC('[email removido]');
//Attachments
// $mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
// $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
//Content
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = $dados_form['assunto'];
$mail->Body = $dados_form['messagem'];
// $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if ($mail->send()) {
echo 'OK';
}
} catch (Exception $e) {
echo 'Não foi possível enviar o email.';
echo 'Error: ' . $mail->ErrorInfo;
}
endif;