![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 3 Pomógł: 0 Dołączył: 10.02.2012 Ostrzeżenie: (0%) ![]() ![]() |
Witam wszystkich jestem nowym urzytkownikiem borykajacym sie z nastepujacym problemem.
Na stronie mam formularz po wypełnieniu ktorego powinien zostac wysłany mail do mnie. Skrzynka jest przypisana jako domyslna na serwerze hostingowym wiec to działa. Wydaje mi sie ze blad jest gdzies w skrypcie ale nie moge znalezc gdzie: Kod formularza na contact.html <form action=?mailer.php? method=?POST?> <input type="text" name="First" size=:"50" />First name<br /> <input type="text" name="Last" size=:"50" />Last name<br /> <input type="text" name="Street" size=:"50" />Street Address<br /> <input type="text" name="City" size=:"50" />City<br /> <input type="text" name="Postal" size=:"50" maxlength="6" />Postal Code<br /> <input type="text" name="Phone1" size=:"50" maxlength="10" />First phone<br /> <input type="text" name="Phone2" size=:"50" maxlength="10" />Second phone<br /> <input type="text" name="letter" size=:"50" />e-mail<br /> <input type="checkbox" name="waterfall" value="yes" />Do you have waterfall?<br /> <input type="checkbox" name="spa" value="yes" />Do you have SPA?<br /> <input type="checkbox" name="fountain" value="yes" />Do you have fountain?<br /> <p>Type of cover?</p> <input type="radio" name="cover" value="waterbags" /> Waterbags <input type="radio" name="cover" value="safety-cover" /> Safety Cover <input type="radio" name="cover" value="clip-in" /> Clip-in<br /> <input type="radio" name="cover" value="unknown" /> Different/I don't know<br /> </td> </tr> </table> <textarea name="message" cols="70" rows="20">Message</textarea><br /> <input type="submit" name=?submit" value="Send" /> </form> A to kod mailer.php <?php if(isset($_POST['submit'])) { $myemail = 'info@pfpools.com'; $street = $_POST['Street']; $city = $_POST['City']; $postal = $_POST['Postal']; $phone1 = $_POST['phone1']; $phone2 = $_POST['phone2']; $letter = $_POST['e-mail']; $waterfall = $_POST['waterfall']; $spa = $_POST['SPA']; $fountain = $_POST['fountain']; $cover = $_POST['cover']; $message = $_POST['message']; $headers = ?From:Contact Form <$myemail>\r\n?; $headers = ?Reply-To: $first $last <$letter>\r\n?; echo ?Your message has been sent successfully!?; mail($myemail, $street, $city, $postal, $phone1, $phone2, $letter, $waterfall, $spa, $fountain, $cover, $message, $headers); } else { echo ?An error occurred during the submission of your message?; } ?> Jakis pomysl jak rozwiazac ten problem? P.S. Po wypisaniu formularza i wyslaniu przekierowywuje mnie na strone 404. Ten post edytował kubosz00 10.02.2012, 23:55:57 |
|
|
![]()
Post
#2
|
|
![]() Grupa: Zarejestrowani Postów: 433 Pomógł: 64 Dołączył: 29.01.2011 Skąd: Warszawa Ostrzeżenie: (0%) ![]() ![]() |
Witam wszystkich jestem nowym urzytkownikiem borykajacym sie z nastepujacym problemem. ale chyba nie jestes uzytkownikiem slownika, co? ![]() formatuj kod plik html i php sa w tym samym folderze te znaki zapytania ktore widac tu i tam sa normalnie w kodzie, czy tak przy wklejaniu popsulo? -------------------- |
|
|
![]()
Post
#3
|
|
Grupa: Zarejestrowani Postów: 439 Pomógł: 0 Dołączył: 3.06.2010 Ostrzeżenie: (50%) ![]() ![]() |
funkcja mail może byc zablokowana na twoim serwerze, urzyj klasy phpmailer
|
|
|
![]()
Post
#4
|
|
Grupa: Zarejestrowani Postów: 189 Pomógł: 13 Dołączył: 20.09.2008 Skąd: Lublin Ostrzeżenie: (0%) ![]() ![]() |
http://php.net/manual/en/function.mail.php
w swoim wywołaniu funkcji podajesz złe parametry. przydałoby się, żebyś połączył jakoś zawartość tego maila i dopiero wtedy przesłał go przez mail(). kodu nie podam, bo widzę, że nawet nie próbowałeś nic z nim zrobić. poza tym przykładowe kody są w linku powyżej. |
|
|
![]()
Post
#5
|
|
Grupa: Zarejestrowani Postów: 84 Pomógł: 5 Dołączył: 12.01.2010 Ostrzeżenie: (0%) ![]() ![]() |
Proponuje zrobić tak jak mówi borpaw, jak będziesz miał phpmailera to będzie Ci to działało na kążdym serwerze....
|
|
|
![]()
Post
#6
|
|
![]() Grupa: Zarejestrowani Postów: 433 Pomógł: 64 Dołączył: 29.01.2011 Skąd: Warszawa Ostrzeżenie: (0%) ![]() ![]() |
Cytat P.S. Po wypisaniu formularza i wyslaniu przekierowywuje mnie na strone 404. gdyby to byl problem z funkcja, to dostalby po prostu biala strone albo bledy. A to, ze parametry mail wygladaja potwornie, to juz inna sprawa ![]() -------------------- |
|
|
![]()
Post
#7
|
|
Grupa: Zarejestrowani Postów: 3 Pomógł: 0 Dołączył: 10.02.2012 Ostrzeżenie: (0%) ![]() ![]() |
Dzieki wszystkim za zainteresowanie tematem:-D
Cytat ale chyba nie jestes uzytkownikiem slownika, co? Tego dnia niestety slownik mnie opuscil. Cytat funkcja mail może byc zablokowana na twoim serwerze, urzyj klasy phpmailer Funkcja mail na serwerze dziala, pytalem na help desku. Ogolnie to jestem zielony w sprawach php, kilka lat lemu bawilem sie amatorsko w robienie stron w html, jednorazowo do tego powrocilem z zamiarem zrobienia tylko jednej strony. Kod ktory mam znalazlem na FAQ firmy hostingujacej, oryginalnie wygladalo to tak Cytat Our servers require SMTP authentication, which in plain English means you will have to use any of your e-mail accounts, created within the E-mail Manager -> E-mail Accounts section from your control panel. You can see the code of an example contact form below(contact.html): <html> <head> <title> Contact form </title> </head> <body> <center> <font size="5"> <b> Contact form </b> <br> <br> </font> <form method="POST" action="mailer.php"> Subject: <input type="text" name="subject" size="20"> <br> <br> Name: <input type="text" name="name" size="20"> <br> <br> E-mail: <input type="text" name="email" size="20"> <br> <br> Message:<br> <textarea rows="9" name="message" cols="30"> </textarea> <br> <br> <input type="submit" value="Send" name="submit"> </form> </center> </body> </html> To have the form working you will also have to create a file called mailer.php with the below code: <?php if(isset($_POST['submit'])) { $myemail = "youremail@yourdomain.com"; Caution: replace youremail@yourdomain.com with a vaild one you created in Email Manager $subject = $_POST['subject']; $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $headers = "From:Contact Form <$myemail>\r\n"; $headers .= "Reply-To: $name <$email>\r\n"; echo "Your message has been sent successfully!"; mail($myemail, $subject, $message, $headers); } else { echo "An error occurred during the submission of your message"; } ?> If you already have a non-working contact form try adding the following variables and check if it works: $mymail = .youremail@yourdomain.com"; $headers = .From:Contact Form <$myemail>\r\n"; $headers .= .Reply-To: $name <$email>\r\n"; mail($mymail, $subject, $message ,$headers); NOTE: The Reply-To header could be set with different variable than $email, depending on the contact form itself. If your contact form already has the $header or $headers variable you will have to add the code with the following change: $mymail = .youremail@account.com"; $headers .= .From:Contact Form <$myemail>\r\n"; $headers .= .Reply-To: $name <$email>\r\n"; mail($mymail, $subject, $message ,$header); NOTE: The Reply-To header could be set with different variable than $email, depending on the contact form itself. If you wish the messages from the contact form to be received in e-mail box which is not on our servers just replace the $mymail in the mail() function with the e-mail where the e-mails should be sent to. Wydaje mi sie ze zrobilem wszystko analogicznie do powyzszego przykladu? Ten post edytował kubosz00 11.02.2012, 16:10:54 |
|
|
![]()
Post
#8
|
|
Grupa: Zarejestrowani Postów: 65 Pomógł: 9 Dołączył: 8.02.2012 Ostrzeżenie: (0%) ![]() ![]() |
|
|
|
![]()
Post
#9
|
|
Grupa: Zarejestrowani Postów: 3 Pomógł: 0 Dołączył: 10.02.2012 Ostrzeżenie: (0%) ![]() ![]() |
Uzylem tego skryptu zamiast starego i wszystko po wpisaniu formularza i wyslaniu go maile dochodza ale niestety nie dostaje informacji od kogo. Pole e-mail nie zostaje przeslane. Da sie to tak rozwiazac zeby po wpisaniu maila do pola e-mail zostal on wyslany do mnie zebym mogl na niego odpowiedziec? Kod <?php
include('./config_mail.php'); if (isset($_POST['email_send'])) { $email = htmlspecialchars(trim($_POST['email_to'])); $title = htmlspecialchars(trim($_POST['email_title'])); $message = htmlspecialchars(trim($_POST['email_msg'])); if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email)) { $error = true; $errorMsg = 'Proszę wpisać poprawny adres email.<br />'; } if (strlen($title) < 3) { $error = true; $errorMsg .= 'Proszę wpisać poprawną nazwę tematu.<br />'; } if (strlen($message) < 5) { $error = true; $errorMsg .= 'Minimalna długość wiadomości to 5 znaków.<br />'; } if (!isset($error)) { $content = "From: $email <$email>\n"; $content .= "MIME-Version: 1.0\n"; $content .= "Content-Type: multipart/mixed;\n"; $content .= "\tboundary=\"___$znacznik==\""; $msg = "--___$znacznik==\n"; $msg .="Content-Type: text/html; charset=\"utf-8\"\n"; $msg .="Content-transfer-encoding: 7bit\n\n"; $msg .="\n $message"; if (@mail($email_adress, $title, $msg, $content)) { echo 'Email zostal poprawnie wyslany.<br /><br />'; } else { echo 'Wystąpily blędy podczas wysylania maila!<br />Prosimy spróbować później.<br /><br />'; } } else { echo $errorMsg, '<br />'; } } ?> <form action="" method="post"> <table border="0" cellpadding="3" cellspacing="0" width="100%"> <tr> <td width="10%" align="right">Email:</td> <td><input type="text" size="25" name="email_to" /> <em><small>Email kontaktowy.</small></em></td> </tr> <tr> <td width="10%" align="right">Temat wiadomości:</td> <td><input type="text" size="25" name="email_title" /></td> </tr> <tr> <td valign="top" width="10%" align="right">Wiadomość:</td> <td><textarea name="email_msg" cols="25" rows="6"></textarea></td> </tr> <tr> <td width="10%" align="right"></td> <td><input type="submit" value="Wyślij wiadomość" name="email_send" /></td> </tr> </table> </form> |
|
|
![]()
Post
#10
|
|
Grupa: Zarejestrowani Postów: 1 233 Pomógł: 87 Dołączył: 6.03.2009 Ostrzeżenie: (40%) ![]() ![]() |
Sposób w jaki tworzysz nagłówki wiadomości to patologia, może przypadkiem zadziała, ale któregoś dnia trafisz na mniej liberalny serwer SMTP, Twoja wiadomość zostanie odrzucona, a w najgorszym przypadku dostaniesz bana.
W repozytorium PEAR dostępnych jest szereg wyśmienitych narzędzi do generowania i wysyłki wiadomości email. Użyj ich. Ten post edytował wNogachSpisz 11.02.2012, 19:19:32 |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 14.07.2025 - 12:05 |