Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> phpMailer - nie działa wysyłanie maila
Cadi2108
post
Post #1





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 12.04.2010

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


Witam!

Oto mój formularz

  1. <form method="post" name="kontakt" action="send_mail.php">
  2. <fieldset class="formularz_kontaktowy">
  3. <legend>Formularz kontaktowy</legend>
  4. <div><label id="lblStatus"></label></div>
  5. <div><input type="text" name="txtName" title="Imię i nazwisko" id="txtName" class="text"></div>
  6. <div><input type="text" name="txtEmail" title="Email" id="txtEmail" class="text"></div>
  7. <div><input type="text" name="txtTitle" title="Tytuł" id="txtTitle" class="text"></div>
  8. <div><textarea cols="30" rows="10" name="txtMessage" id="txtMessage" class="text" title="Treść wiadomości"></textarea></div>
  9. <input type="submit" value="Wyślij">
  10. </form>


A tutaj plik send_mail.php

  1. <?php
  2. require_once('phpmailer/class.phpmailer.php');
  3. $mail = new PHPMailer(true);
  4.  
  5. $mail->PluginDir = "phpmailer/";
  6. $mail->IsSMTP();
  7. $mail->SMTPAuth = true; // enable SMTP authentication
  8. $mail->SMTPSecure = "ssl"; // sets the prefix to the servier
  9. $mail->Host = "smtp.gmail.com";
  10. $mail->Port = 465;
  11. $mail->Username = "xxx@gmail.com";
  12. $mail->Password = "xxxxx";
  13.  
  14. $mail->SetFrom('xxx@gmail.com', 'Nasze imie i nazwisko');
  15.  
  16. $mail->AddAddress("email@adresata.pl"); // ADRESAT
  17.  
  18. $mail->Subject = 'To jest wiadomość testowa. Sprawdzam czcionki!';
  19.  
  20. // w zmienną $text_body wpisujemy treść maila
  21. $text_body = "Cześć, chyba phpMailer działa \n\n";
  22. $text_body .= "Na zawsze Twój, \n";
  23. $text_body .= "PHPMailer";
  24.  
  25. $mail->Body = $text_body;
  26.  
  27. if(!$mail->Send())
  28. echo "There has been a mail error <br>";
  29. echo $mail->ErrorInfo."<br>";
  30.  
  31. // Clear all addresses and attachments
  32. $mail->ClearAddresses();
  33. $mail->ClearAttachments();
  34. echo "mail sent <br>";
  35. ?>


Jak widać, jeszcze nic z formularza nie jest pobierane, wszystko jest wpisane na sztywno. Login i hasło są na pewno poprawne. Niestety, po naciśnięciu przycisku wysyłającego formularz pojawia się na pasku url localhost/send_mail.php i pusta strona, ani komunikat o błędzie ani nic. Mail oczywiście nie dochodzi. Ma ktoś może pomysł, jaka może być przyczyna?

Serdecznie pozdrawiam,
Dagna

Ten post edytował Cadi2108 15.06.2012, 09:35:31
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
nospor
post
Post #2





Grupa: Moderatorzy
Postów: 36 559
Pomógł: 6315
Dołączył: 27.12.2004




Skoro masz pustą stronę, znaczy że masz PARSE ERROR/FATAL ERROR lub coś podobnego. Włącz w php.ini wyświetlanie wszystkich błędów
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: 9.10.2025 - 23:20