<?php
require_once('class.phpmailer.php');
require_once('class.smtp.php');
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = 'xxx.xxx.xxx.xxx'; // SMTP Server
$mail->SMTPDebug = false; // Debugmode
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->IsHTML(true);
$mail->SMTPSecure = 'tls';
$mail->Port = 587; // set the SMTP port for the GMAIL
$mail->Username = 'bulutto@xxx.com'; // SMTP account username
$mail->Password = "xxx"; // SMTP account password
$mail->SetFrom('bulutto@xxx.com','Bulutto');
$mail->CharSet = 'iso-8859-9';
$mail->ContentType = 'text/html';
$mail->AddReplyTo('bulutto@xxx.com','Bulutto');
$mail->Subject = 'deneme mail';
//$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->Body = 'bu bir denem mesajı';
$mail->AddAddress('gonderilen@xxx.com', '');
if(!$mail->Send()) {
echo '<div style="float:left; margin-top:5px; width:100%; color: #FF0000;">hata: '. $mail->ErrorInfo .'</div>';
} else {
echo '<div style="float:left; margin-top:5px; width:100%; color: #FF0000;">başarılı</div>';
}
?>hosta göre alınan hatalar;mail.google.com ip sini ve google.com ipsini kullanınca aşağıdaki hatayı alıyorum(hem 587 portu hemde 26 ortu aynı sonuç):
SMTP -> ERROR: Failed to connect to server: Connection timed out (110)
The following From address failed: bulutto@xxx.com Hata: The following From address failed: bulutto@xxx.com
hosting sağlayıcımın ip adresini kullanıcada aşağıdaki hatayı alıyorum:
SMTP -> FROM SERVER:220-ns23.xxx.com ESMTP Exim 4.77 #2 Mon, 17 Sep 2012 13:47:15 +0300 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
SMTP -> FROM SERVER: 250-ns23.xxx.com Hello host-xx-xxx-xx-xxx.static.xxx.com [xx.xxx.xx.xxx] 250-SIZE 52428800 250-PIPELINING 250-AUTH PLAIN LOGIN 250-STARTTLS 250 HELP
SMTP -> FROM SERVER:220 TLS go ahead
SMTP -> FROM SERVER: 250-ns23.xxx.com Hello host-xx-xxx-xx-xxx.static.xxx.com [xx.xxx.xx.xxx] 250-SIZE 52428800 250-PIPELINING 250-AUTH PLAIN LOGIN 250 HELP
SMTP -> ERROR: Password not accepted from server: 535 Incorrect authentication data
SMTP -> FROM SERVER:250 Reset OK
SMTP -> FROM SERVER:250 OK
SMTP -> FROM SERVER:550 SMTP AUTH is required for message submission on port 587
SMTP -> ERROR: RCPT not accepted from server: 550 SMTP AUTH is required for message submission on port 587
SMTP Error: The following recipients failed: gonderilen@xxx.com Hata: SMTP Error: The following recipients failed: gonderilen@xxx.com
SMTP server error: SMTP AUTH is required for message submission on port 587