3 NİSAN 2009, Cuma
E-posta GMail SMTP sunucusunu kullanarak bir PHP sayfasından gönder
Bir PHP sayfasından GMail SMTP sunucusu üzerinden e-posta göndermek için çalışıyorum, ama ben bu hatayı alıyorum:
kimlik doğrulama hatası [SMTP: kimlik doğrulama (kod: 250, yanıt: hizmetinizde mx.google.com , [98.117.99.235 SİZE] 35651584 8BITMIME STARTTLS ENHANCEDSTATUSCODES ARDIŞIK)] desteği yok SMTP sunucusu
Herkes yardımcı olabilir? İşte benim kod:
<?php
require_once "Mail.php";
$from = "Sandra Sender <sender@example.com>";
$to = "Ramona Recipient <ramona@microsoft.com>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "smtp.gmail.com";
$port = "587";
$username = "testtest@gmail.com";
$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>");
}
?>
CEVAP
1 Mayıs 2010, CUMARTESİ
// Pear Mail Library
require_once "Mail.php";
$from = '<from.gmail.com>';
$to = '<to.yahoo.com>';
$subject = 'Hi!';
$body = "Hi,\n\nHow are you?";
$headers = array(
'From' => $from,
'To' => $to,
'Subject' => $subject
);
$smtp = Mail::factory('smtp', array(
'host' => 'ssl://smtp.gmail.com',
'port' => '465',
'auth' => true,
'username' => 'johndoe@gmail.com',
'password' => 'passwordxxx'
));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo('<p>' . $mail->getMessage() . '</p>');
} else {
echo('<p>Message successfully sent!</p>');
}
Lütfen bunu kullanın çok çalışan kod.
Bunu Paylaş:
E-posta SMTP kullanarak C ile gönder#...
Nasıl Java uygulaması GMail, Yahoo vey...
C ile Gmail SMTP sunucusu üzerinden e-...
"uzaktan sertifika doğrulama işle...
Python SMTP kullanarak posta gönderme...