Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [HTML][PHP]Prosty php mail formularz z template monster, Formularz php wysyla wiadomosci ale nie dochodza
jzagaja
post
Post #1





Grupa: Zarejestrowani
Postów: 3
Pomógł: 0
Dołączył: 1.10.2009

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


Mam taki oto formularz php z template monster i umiescilem go na serwerze home.pl. Wysyla on wiadomosci ze strony flash i ma jeszcze plik konfiguracyjny xml. Wiadomosc zostaje wyslana pomyslnie ale nie dochodzi na adres ktory jest wpisany w tym pliku xml. Oto tresc tego skryptu:



  1. <?php
  2. //-----------------Getting data sent by flash---------------------
  3. foreach ($_POST as $key => $value){
  4.  
  5. if ($key != 'mail_to' && $key != 'smtp_server' && $key != 'smtp_port' && $key != 'mail_from' && $key != 'mail_subject' && $key != 'plain_text'){
  6.  
  7. $mail_body .= '<b>'.str_replace('_',' ',$key).'</b>:<br/>';
  8.  
  9. $mail_body .= ''.stripslashes($value).'<br/>';
  10. }
  11. }
  12. //-----------------------------------------------------------------
  13.  
  14.  
  15.  
  16. $message = '<html><body>'.$mail_body.'</body></html>'; // mail body
  17.  
  18. //------------if plain text is set to true removing html tags------
  19. if ($_POST['plain_text']=='true') {
  20.  
  21. $message = str_replace('<br/>',"\r\n", $message);
  22.  
  23. $message = strip_tags($message);
  24.  
  25. //------------------------------------------------------------------
  26. } else {
  27. //----otherwise composing message headers---------------------------
  28. $headers = 'MIME-Version: 1.0' . "\r\n";
  29.  
  30. $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  31. //------------------------------------------------------------------
  32. }
  33.  
  34. //------------setting conf data-------------------------------------
  35. $to = $_POST['mail_to'];
  36.  
  37. $from = $_POST['mail_from'];
  38.  
  39. $subject = $_POST['mail_subject'];
  40.  
  41. $smtp_server = $_POST['smtp_server'];
  42.  
  43. $smtp_port = $_POST['smtp_port'];
  44. //------------------------------------------------------------------
  45.  
  46. //---------setting header info--------------------------------------
  47. $headers .= 'To: '.$to. "\r\n";
  48.  
  49. $headers .= 'From: Site visitor ' .$from. "\r\n";
  50. //------------------------------------------------------------------
  51.  
  52.  
  53. if (mail($to, $subject, $message, $headers)){ // sending mail
  54.  
  55. print('&mail=1'); //succes
  56.  
  57. } else {
  58.  
  59. print('&mail=0');//failure
  60.  
  61. }
  62.  
  63. ?>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
MateuszS
post
Post #2





Grupa: Zarejestrowani
Postów: 1 429
Pomógł: 195
Dołączył: 6.10.2008
Skąd: Kraków/Tomaszów Lubelski

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


upewnij sie ze wpisales email z ktorego ma byc wysylany ten email ktory wpisujesz, czy wszystkie ustawienia sa OK

ps. mail() nie dziala bodajrze pod windowsem, ale na hostingu winna dzialac.
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: 15.10.2025 - 11:27