Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Problem z wysyłaniem maili PHPMailer
Forum PHP.pl > Forum > PHP
pietroff
Witam

mam problem z wysyłaniem maili za pomocą PHPMailer poniżej kod. Czy możecie wskazać mi błąd? Bo już ręce opadają, ciągle dostaję odpowiedź:
"Message was not sent.Mailer error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki...eshooting"

  1. function send_mail($email,$message,$subject)
  2. {
  3. require_once('mailer/class.phpmailer.php'); //dodanie klasy phpmailer
  4. require_once('mailer/class.smtp.php'); //dodanie klasy smtp
  5. $mail = new PHPMailer();
  6. $mail->IsSMTP(); // telling the class to use SMTP
  7. $mail->Host = "poczta.o2.pl"; // specify main and backup server
  8. $mail->Port = 587;
  9. $mail->SMTPAuth = true; // turn on SMTP authentication
  10. $mail->Username = 'adres@tlen.pl'; //SMTP username
  11. $mail->Password = '**********'; // SMTP password
  12. $mail->From = 'adres@tlen.pl';
  13. $mail->AddAddress($email);
  14.  
  15. $mail->Subject = $subject;
  16. $mail->Body = $message;
  17. $mail->WordWrap = 50;
  18.  
  19. if(!$mail->Send()){
  20. echo 'Message was not sent.';
  21. echo 'Mailer error: ' . $mail->ErrorInfo;
  22. }
  23. else{
  24. echo 'Message has been sent.';
  25. }
  26. }
  27.  
trueblue
A może warto zajrzeć do źródła?
https://pomoc.o2.pl/jak-skonfigurowac-program-pocztowy
pietroff
ok po zmianie portu na 465 otrzymuje komunikat:

Message was not sent.Mailer error: Could not instantiate mail function.
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.