PHP Gönder posta hata

2 Cevap php

PHP Yeni duyuyorum bana yardımcı ve son 5 Saat beri i semd posta deneyin ve şimdi gerçekten yorgun ediyorum lütfen. Teşekkürler.

Here is my code. I am using Gmail account.

include("class.phpmailer.php");
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded

$mail             = new PHPMailer();

$body             = $mail->getFile('contents.html');
$body             = eregi_replace("[\]",'',$body);

$mail->IsSMTP();
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
$mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
$mail->Port       = 465;                   // set the SMTP port for the GMAIL server

$mail->Username   = "hussaintalha@gmail.com";  // GMAIL username
$mail->Password   = "xxxxxxxx";            // GMAIL password

$mail->AddReplyTo("hussaintalha@gmail.com","First Last");

$mail->From       = "hussaintalha@gmail.com.com";
$mail->FromName   = "First Last";

$mail->Subject    = "PHPMailer Test Subject via gmail";

//$mail->Body       = "Hi,<br>This is the HTML BODY<br>";                      //HTML Body
$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->WordWrap   = 50; // set word wrap

$mail->MsgHTML($body);

$mail->AddAddress("hussaintalha@gmail.com", "John Doe");

$mail->AddAttachment("images/phpmailer.gif");             // attachment

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

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

Benim dosyasını çalıştırdığınızda bu hatayı alıyorum:

Warning: fopen(contents.html) [function.fopen]: failed to open stream: No such file or directory in D:\xampplite\htdocs\WebEng\class.phpmailer.php on line 1870

Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.gmail.com:465 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?) in D:\xampplite\htdocs\WebEng\class.smtp.php on line 122 Mailer Error: SMTP Error: Could not connect to SMTP host.

2 Cevap

Hata mesajları olsun her şeyden önce o harika! Başkalarının onları da vardı ki bulmak vakaların% 90 ve bu nedenle bu hata iletisi hakkında internette pek çok bilgi bulabilirsiniz çünkü.

Henüz her zaman açık google biliyor ve oraya yapıştırın kopya yok, bir hata mesajı alıyorum Yani 1 adım. Ancak, benzersiz sisteme bağlı herhangi yolları ya da başka şeyler çıkar.

Then about your errors. Especially xampp light doesn't support SSL. Maybe you try an easier sendmail example first. Like a very small one and then increase it step by step. That's what I always do, when I don't know why something doesn't work. I start with one line and see what it does, then I add another and so forth.

Diyelim ki bu ile başlar ve eğer çalışırsa söyleyin bakalım:

<?php

include("class.phpmailer.php");

$mail             = new PHPMailer();

$mail->IsSMTP();
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
$mail->Port       = 465;                   // set the SMTP port for the GMAIL server
$mail->Username   = "hussaintalha@gmail.com";  // GMAIL username
$mail->Password   = "xxxxxxxx";            // GMAIL password

$mail->From       = "hussaintalha@gmail.com";
$mail->Subject    = "PHPMailer Test Subject via gmail";
$mail->Body       = "Hi, this is a test";           
$mail->AddAddress("hussaintalha@gmail.com", "Hussain");

$mail->send();
?>

oh, söyliyim. gelen posta çok bir. com var!

(O bakışlarla XAMPP,) size PHP kurulum SSL desteklemiyor. Emin olun hat

extension=php_openssl.dll

not php.ini üzerinden yorumladı, Apache yeniden başlatın, ve hala işe yaramazsa Apache ikili (. exe içine PHP dizinin üzerine yazma (veya kopyalama) ssleay32.dll ve libeay32.dll deneyin ) dizin sonra Apache yeniden başlatın.