PHPMailer kullanırken gönderiliyor değil maille

2 Cevap php

Ben bir smtp sunucusuna posta göndermek için aşağıdaki kodu kullanıyorum.

<?php

// example on using PHPMailer with GMAIL
include("PHPMailer/class.phpmailer.php");
include("PHPMailer/class.smtp.php"); // note, this is optional - gets called from main class if not already loaded

$mail             = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->Host       = "mucse491.eu.xxxxx.com";      // sets GMAIL as the SMTP server
$mail->Port       = 143;                   // set the SMTP port
$mail->Username   = "xxxxx@xxx.com";  // GMAIL username
$mail->Password   = "xxxx";            // GMAIL password

$mail->From       = "xxxxx@xxx.com";
$mail->FromName   = "mithun";
$mail->Subject    = "This is the subject";
$mail->AltBody    = "This is the body when user views in plain text format"; //Text Body
$mail->WordWrap   = 50; // set word wrap

$mail->AddAddress("xxxxx@xxx.com","First Last");

$mail->IsHTML(true); // send as HTML

if(!$mail->Send()) {
  echo "Mailer Error: " . $mail->ErrorInfo;
} else {
  echo "Message has been sent";
}

?>

Ben komut satırından çalıştırdığınızda aşağıdaki hatayı alıyorum

PHP Deprecated:  Function eregi() is deprecated in C:\wamp\www\phpmailer\class.p
hpmailer.php on line 593

Deprecated: Function eregi() is deprecated in C:\wamp\www\phpmailer\class.phpmai
ler.php on line 593
PHP Warning:  fputs() expects parameter 1 to be resource, integer given in C:\wa
mp\www\phpmailer\class.smtp.php on line 213

Warning: fputs() expects parameter 1 to be resource, integer given in C:\wamp\ww
w\phpmailer\class.smtp.php on line 213
Mailer Error: SMTP Error: Could not connect to SMTP host.

I tarayıcıdan çalıştırdığınızda aşağıdaki hatayı alıyorum

Deprecated: Function eregi() is deprecated in C:\wamp\www\phpmailer\class.phpmailer.php on line 593

Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server. in C:\wamp\www\phpmailer\class.smtp.php on line 122

Warning: fsockopen() [function.fsockopen]: unable to connect to mucse491.xx.xxxxx.com:143 (php_network_getaddresses: getaddrinfo failed: This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server. ) in C:\wamp\www\phpmailer\class.smtp.php on line 122
Mailer Error: SMTP Error: Could not connect to SMTP host.

Birisi Lütfen bana yol.

2 Cevap

PHP'nin eski bir sürümü ile çalışmak üzere tasarlanmış PHPMailer bir sürümü var gibi görünüyveya.

Yani:

1) uyumlu PHP bir alt versiyonu için Downgrade

veya

Eğer varsa 2)) (yeni bir sürüme yükseltme PHPMailer

veya

3) Farklı bir posta kitaplığı kullanın

Eğer doğrudan SMTP sunucusunun IP adresini koyarak denedim $mail->Host? Bir nedenle veya başka için PHP sorun kullanmak çalıştığınız sunucunun DNS çözme yaşıyor.