Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP]Problem phpmailer
Forum PHP.pl > Forum > Przedszkole
uki0008
Witam wyskakuje mi ciągle taki błąd:

  1. SMTP Error: Could not connect to SMTP host. There has been a mail error
  2. SMTP Error: Could not connect to SMTP host.
  3. mail sent


Wygooglowałem itp i nic nie pomaga.

tak wygląda konfiguracja:
  1. <?php
  2. require("phpmailer/class.phpmailer.php");
  3.  
  4. $mail = new PHPMailer();
  5.  
  6. $mail->IsSMTP();
  7. $mail->From = "witaszekl@wp.pl.pl"; //adres naszego konta
  8. $mail->FromName = "phpMailer tester";//nagłówek From
  9. $mail->Host = "smtp.wp.pl";//adres serwera SMTP
  10. $mail->Mailer = "smtp";
  11. $mail->Username = "witaszekl";//nazwa użytkownika
  12. $mail->Password = "****";//nasze hasło do konta SMTP
  13. $mail->SMTPAuth = true;
  14. $SMTPDebug = true;
  15. $mail->SetLanguage("pl", "mail/language/");
  16.  
  17. $mail->Subject = "Mail testowy";//temat maila
  18.  
  19. // w zmiennš $text_body wpisujemy treœć maila
  20. $text_body = "Czeœć, chyba phpMailer działa \n\n";
  21. $text_body .= "Na zawsze Twój, \n";
  22. $text_body .= "PHPMailer";
  23.  
  24. $mail->Body = $text_body;
  25. // adresatów dodajemy poprzez metode 'AddAddress'
  26. $mail->AddAddress("uki0008@gmail.com");
  27.  
  28. if(!$mail->Send())
  29. echo "There has been a mail error <br>";
  30. echo $mail->ErrorInfo."<br>";
  31.  
  32. // Clear all addresses and attachments
  33. $mail->ClearAddresses();
  34. $mail->ClearAttachments();
  35. echo "mail sent <br>";
  36.  
  37. ?>
Barcelona
  1. $mail->From = "witaszekl@wp.pl.pl"; //adres naszego konta


Zamień na

  1. $mail->From = "witaszekl@wp.pl"; //adres naszego konta


Nie wiem czy to pomoże (w co wątpie). Czytałeś dokumentacje? Ja też miałem problemy z phpmailer i dopiero tam znalazłem odpowiedź. Albo najlepiej załóż sobie skrzynke na gmail. W dokumentacji jest opisane jak skonfigurować skrypt pod to konto.
uki0008
Witam jak mógłbyś podesłać mi plik konfiguracyjny który masz byłbym wdzięczny.
Barcelona
  1. <?php
  2.  
  3. // example on using PHPMailer with GMAIL
  4.  
  5. include("class.phpmailer.php");
  6. include("class.smtp.php"); // note, this is optional - gets called from main class if not already loaded
  7.  
  8. $mail = new PHPMailer();
  9.  
  10. $body = $mail->getFile('contents.html');
  11. $body = eregi_replace("[\]",'',$body);
  12.  
  13. $mail->IsSMTP();
  14. $mail->SMTPAuth = true; // enable SMTP authentication
  15. $mail->SMTPSecure = "ssl"; // sets the prefix to the servier
  16. $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
  17. $mail->Port = 465; // set the SMTP port
  18.  
  19. $mail->Username = "yourname@gmail.com"; // GMAIL username
  20. $mail->Password = "password"; // GMAIL password
  21.  
  22. $mail->From = "replyto@yourdomain.com";
  23. $mail->FromName = "Webmaster";
  24. $mail->Subject = "This is the subject";
  25. $mail->AltBody = "This is the body when user views in plain text format"; //Text Body
  26. $mail->WordWrap = 50; // set word wrap
  27.  
  28. $mail->MsgHTML($body);
  29.  
  30. $mail->AddReplyTo("replyto@yourdomain.com","Webmaster");
  31.  
  32. $mail->AddAttachment("/path/to/file.zip"); // attachment
  33. $mail->AddAttachment("/path/to/image.jpg", "new.jpg"); // attachment
  34.  
  35. $mail->AddAddress("username@domain.com","First Last");
  36.  
  37. $mail->IsHTML(true); // send as HTML
  38.  
  39. if(!$mail->Send()) {
  40. echo "Mailer Error: " . $mail->ErrorInfo;
  41. } else {
  42. echo "Message has been sent";
  43. }
  44.  
  45. ?>
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.