PHP için tamamen yeni ve PHP kullanarak posta göndermek istiyorum. Bana ulaşan kişinin e-posta adresini kabul edecek bir İletişim Formu aldım ve bu yüzden posta bana gönderilecek. PHPMailer kitaplığı https://github.com/PHPMailer/PHPMailer/tree/master'dan kullanıyorum ve aşağıdaki kod snippet'i kullanıyorum.SMTP connect() PHPMailer'de hata oldu
<?php
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPSecure = 'tls';
$mail->Host = "resolver1.opendns.com"; // this SMTP server of my machine
//$mail->Host = "208.67.222.222";//ip ; which one to use the resolver1.opendns.com or 208.67.222.222 ???
$mail->From = "[email protected];//email id of the person
$mail->AddAddress("[email protected]");//my email id
$mail->Subject = "First PHPMailer Message";
$mail->Body = "Hi! \n\n This is my first e-mail sent through PHPMailer.";
$mail->WordWrap = 50;
if(!$mail->Send())
{
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
}
else
{
echo 'Message has been sent.';
}
?>
"İleti gönderilmedi.Mailer hatası: SMTP connect() başarısız oldu." Problemin ne olduğunu anlamıyorum ..? $ mail-> Host = ""; Lütfen bunun ne anlama geldiğini yorumlayınız?
sonra lütfen kaldırın ağ arayüzü bir IPv6 adresi varsa. –
Bu resolver1.opendns.com'un e-postanızı kabul edeceğini sanmıyorum. –
Çalışması için '$ mail-> Port = $ SmtpPort;' eklemek zorunda kaldım. Geliştirme sunucusunda çalıştı, ancak bundan önceki üretimde değil. – minipif