2016-09-01 25 views
5

Staram wysyłania wiadomości e-mail przy użyciu PHPMailer bez TLS, ale PHPMailer nadal próbuje wysłać wiadomość e-mail z TLS nawet jeśli nie włączyć go:PHPMailer wysyła z TLS nawet gdy szyfrowanie nie jest włączona

include_once("PHPMailer-master\PHPMailerAutoload.php"); 

$To = '[email protected]'; 
$Subject = 'Topic'; 
$Message = 'msg test'; 

$Host = 'site.com.br'; 
$Username = '[email protected]'; 
$Password = 'pass'; 
$Port = "587"; 

$mail = new PHPMailer(); 
$body = $Message; 
$mail->IsSMTP(); // telling the class to use SMTP 
$mail->Host = $Host; // SMTP server 
$mail->SMTPDebug = 1; // enables SMTP debug information (for testing) 
// 1 = errors and messages 
// 2 = messages only 
$mail->SMTPAuth = true; // enable SMTP authentication 
//$mail->SMTPSecure = 'ssl'; //or tsl -> switched off 
$mail->Port = $Port; // set the SMTP port for the service server 
$mail->Username = $Username; // account username 
$mail->Password = $Password; // account password 

$mail->SetFrom($Username); 
$mail->Subject = $Subject; 
$mail->MsgHTML($Message); 
$mail->AddAddress($To); 

if(!$mail->Send()) { 
    $mensagemRetorno = 'Error: '. print($mail->ErrorInfo); 
    echo $mensagemRetorno; 
} else { 
    $mensagemRetorno = 'E-mail sent!'; 
    echo $mensagemRetorno; 
} 

Po send email , Mam tę wiadomość:

2016-09-01 21:08:55 CLIENT -> SERVER: EHLO www.johnmendes.com.br 
2016-09-01 21:08:55 CLIENT -> SERVER: STARTTLS 
2016-09-01 21:08:55 SMTP ERROR: STARTTLS command failed: 454 TLS not available due to temporary reason 
2016-09-01 21:08:55 SMTP Error: Could not connect to SMTP host. 
2016-09-01 21:08:55 CLIENT -> SERVER: QUIT 
2016-09-01 21:08:55 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting 
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting 
Erro ao enviar e-mail: 1 

Serwer nie obsługuje ssl lub tls.

Każdy pomysł?

Odpowiedz

12

Jest to omówione w dokumentacji PHPMailer. PHPMailer stosuje oportunistyczne TLS - jeśli serwer reklamuje, że może wykonać TLS (co robi twój), użyje go automatycznie, bez pytania. Możesz wyłączyć to:

$mail->SMTPSecure = false; 
$mail->SMTPAutoTLS = false; 

Z komunikatu o błędzie wygląda na to, że jest to tymczasowy problem u dostawcy usług hostingowych. Więcej informacji znajdziesz, ustawiając $mail->SMTPDebug = 2;.

Widzę, że oparłeś swój kod na przestarzałym przykładzie, więc upewnij się, że masz the latest version of PHPMailer i oprzyj swój kod na dostarczonych przykładach.

Powiązane problemy