Bir PHP sayfasından GMail'in SMTP sunucusu aracılığıyla bir e-posta göndermeye çalışıyorum, ancak bu hatayı alıyorum:
kimlik doğrulama hatası [SMTP: SMTP sunucusu kimlik doğrulamayı desteklemiyor (kod: 250, yanıt: mx.google.com hizmetinizde, [98.117.99.235] SIZE 35651584 8BITMIME STARTTLS ENHANCEDSTATUSCODES PIPELINING)]
Biri yardım edebilir mi? İşte kodum:
<?php
require_once "Mail.php";
$from = "Sandra Sender <[email protected]>";
$to = "Ramona Recipient <[email protected]>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "smtp.gmail.com";
$port = "587";
$username = "[email protected]";
$password = "testtest";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
?>
Kodunuz, [Google'a posta göndermek için gerekli olan (ve 465 veya 587 numaralı bağlantı noktalarını kullanan)] TLS (SSL) kullanmıyor gibi görünüyor1.
Bunu ayarlayarak yapabilirsiniz
$host = "ssl://smtp.gmail.com";
Kodunuz, ana bilgisayar adı şemasında ssl://'e atıfta bulunan bu örnek gibi şüpheli görünüyor.