Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Phpmailer - SMTP Error: Could not connect to SMTP host.
prochniak
post
Post #1





Grupa: Zarejestrowani
Postów: 15
Pomógł: 1
Dołączył: 3.02.2010
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


  1. require_once("phpmailer/class.phpmailer.php");
  2. $mail = new PHPMailer();
  3. $mail->IsSMTP(); // telling the class to use SMTP
  4. $mail->SMTPAuth = true; // authentication enabled
  5. $mail->SMTPSecure = "ssl"; // sets the prefix to the servier
  6. $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
  7. $mail->Port = 465; // set the SMTP port
  8. $mail->SetLanguage("en", "language/");
  9. // $SMTPDebug = true;
  10. $mail->WordWrap = 50;
  11.  
  12. $mail->Username = "prochniak@gmail.com"; // SMTP username
  13. $mail->Password = "xxxxxx"; // SMTP password
  14.  
  15. $mail->SetFrom('prochniak@gmail.com', 'Prochniak');
  16. $mail->AddAddress("prochniak@gmail.com");
  17.  
  18. $mail->Subject = "Test";
  19. $message = 'Hello,';
  20. $mail->MsgHTML($message);
  21. $mail->IsHTML(true); // send as HTML
  22.  
  23. if(!$mail->Send()) {
  24. $msg = 'Message was not sent.<br>';
  25. $msg .= 'Mailer error: ' . $mail->ErrorInfo;
  26. }
  27. else {
  28. $msg = 'Message has been sent.';
  29. }


W wyniku wykonania powyższego kodu dostaje błąd:
SMTP Error: Could not connect to SMTP host.

Szukałem pomocy w necie, ale nie widzę gdzie mam błąd. Może ktoś spojrzeć z boku i sprawdzić?
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 24.08.2025 - 18:16