Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Skrzynka Mail
Ryach
post 1.10.2011, 13:45:52
Post #1





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 1.10.2011

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


Witam wszystkich. od niedawna uczę się pisać własne strony web. Niestety zatrzymał mnie prosty skrypt php który próbuje przygotować dla własnej stronki, która stworzyłem wykorzystując template. Próbowałem już parę wersji tego skryptu tak długo jak używam wyjątkowo prostej jego wersji wszystko działa prawidłowo gdy dodałem go do wczesniej przygotowanego formularza w htmlu poczta jest wysylana ale tylko do mnie a sam skrypt nie pobiera i nie wysyła danych z pól czyli dostaje puste maile.
Bardzo prosze o pomoc gdzie popełniłem błąd lub co robię źle?

wycinek htmla:

  1. <!-- Contact -->
  2. <div class="article">
  3. <h2>Contact me?</h2>
  4.  
  5.  
  6.  
  7.  
  8. <form action="poczta.php" method="post" accept-charset="utf-8">
  9. <div class="cl"> </div>
  10. <div class="column-cnt">
  11. <div class="cl"> </div>
  12. <div class="column">
  13. <label for="your-name">Your Name?</label>
  14. <span class="text-field"><input type="text" id="name" value="" /> </span>
  15. </div>
  16. <div class="column">
  17. <label for="your-email">Your E-mail address?</label>
  18. <span class="text-field"><input type="text" id="email" value="" /></span>
  19. </div>
  20. <div class="cl"> </div>
  21.  
  22. <h2> </h2>
  23. <h2>Do you have any questions, comments, or just want to say hello? <br />
  24. Feel free to contact me using the form, <br />
  25. </h2>
  26. </div>
  27. <div class="column-big">
  28. <label for="your-message">Your Message</label>
  29. <span class="text-area"><textarea id="message" rows="" cols=""></textarea> </span>
  30. <p><input type="submit" value="SUBMIT" /></p>
  31. </div>
  32. <div class="cl"> </div>
  33. </form>
  34. </div>
  35. <!-- End Contact -->


i moj php

  1. <?PHP
  2. $from = $_REQUEST['email'] ;
  3. $name = $_REQUEST['name'] ;
  4. $headers = "name: $name";
  5. $subject = "RafalPortfolio";
  6.  
  7. $fields = array();
  8. $fields{"email"} = "email";
  9. $fields{"name"} = "name";
  10. $fields{"message"} ="message";
  11.  
  12. $body = "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
  13.  
  14. $headers2 = "From: noreply@YourCompany.com";
  15. $subject2 = "Thank you for contacting ";
  16. $autoreply = "Thank you for contacting I will get back to you as soon as possible.";
  17.  
  18. $to = 'xxxxxxx@gmail.com';
  19.  
  20. $send = mail($to, $subject, $body, $headers);
  21. $send2 = mail($from, $subject2, $autoreply, $headers2);
  22.  
  23. $header = "From: Rafal\nContent-Type:".
  24. ' text/plain;charset="iso-8859-2"'.
  25. "\nContent-Transfer-Encoding: 8bit";
  26. if (mail($adresat, 'List ze strony', $name, $message, $email))
  27. echo '<p>działa</p>';
  28. else
  29. echo '<p><b>NIE</b> wysłano maila!</p>';
  30. ?>


Ten post edytował Ryach 1.10.2011, 13:47:26
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 13:37