ContactMe (MailForm)
Moderátor: Moderators
- Spade
- etoModerator
- Príspevky: 171
- Dátum registrácie: Po Apr 17, 2006 2:24 pm
- Kontaktovať používateľa:
ContactMe (MailForm)
Ako sa prosim vola snippet, ktory si pouzil, _rasel^ na svojom webe ako Mail Form? Ak by sa dalo, hod aj zdrojak. Diky moc.
Ách deti moje zlaté, milujte sa a zložte sa. Nech si zvíratá berú od vás príklad.
Človečina, RND.
Človečina, RND.
-
- Moderator & CLT
- Príspevky: 215
- Dátum registrácie: Pi Sep 23, 2005 10:59 am
- Bydlisko: Vysoké Studnice (u Jihlavy)
- Kontaktovať používateľa:
Já jsem použil toto:
Je to lokalizované, funkční a odzkoušené. Akorát si uprav nastavení v snippettu (mail)
Kód: Vybrať všetko
/* ContactMe 0.1 snippet for Etomite by Vassili Slessarenko */
/* This snippet generates a very simple form, which can be used for contact purposes within a website.
It first outputs the form, then it checks the e-mail address that the sender has given and then
returns a "message-has-been-sent" message.
Do make sure the page is non-Cacheable! */
/* Configuration Section (Feel free to change these as needed). */
## This is probably the most important part of the script... It contains the address to which the e-mails will be
## so make sure the address is correct. - sem zadáš svůj mail
$address_to = 'info@tvojedomena.cz';
## These 3 change what is at first displayed in the form fields (once clicked on these disappear):
$initial_name_string = '';
$initial_email_string = '';
$initial_subject_string = '';
## These will determine the size of the fields and should be pretty self-explanatory. Tento blok určuje velikost políček formuláře
$name_width = '50';
$email_width = '50';
$subject_width = '50';
$text_cols = '60';
$text_rows = '8';
# $subject_prepend variable can be used to supply a string which will always come before the user written subject.
# This means you can filter the e-mails by subject and put them into a separate folder. Přepiš si subjekt!!
$subject_prepend = 'SFERA BUBENIKU';
## $email_sent_msg - This sets the message that the sender sees when the e-mail has been successfully sent.
$email_sent_msg = '<h2>Děkujeme Vám za Vaši zprávu!</h2>'."\n";
$email_sent_msg .= "<p>Vaše zpráva byla úspěšně odeslána. </p>"."\n";
/* ------------------------------------------------------*/
/* Don't mess with this unless you know what ur doing!!! */
/* This is the actual code... */
/* ------------------------------------------------------*/
$mail_form = '';
$mail_form .= '<form action="" method="post" id="contact_me">'." \n ";
$mail_form .= '<p><label for="name">Vaše jméno:<br />'." \n ";
$mail_form .= '<input type="text" name="name" id="name"';
if (isset($_POST['name'])) {
$mail_form .= " value=\"".$_POST['name']."\"";
}
else {
$mail_form .= ' value="'.$initial_name_string.'"';
}
if (!isset($_POST['name'])) {
$mail_form .= " onclick=\"document.forms[0].name.value=''\" ";
}
$mail_form .= 'size="'.$name_width.'" /></label>'." \n";
$mail_form .= '<label for="email">Váš e-mail:<br />'." \n";
$mail_form .= '<input type="text" name="email" id="email" ';
if (isset($_POST['email'])) {
$mail_form .= "value=\"".$_POST['email']."\" ";
} else {
$mail_form .= 'value="'.$initial_email_string.'" ';
}
if (!isset($_POST['email'])) {
$mail_form .= "onclick=\"document.forms[0].email.value=''\" ";
}
$mail_form .= 'size="'.$email_width.'" /></label>'."\n";
$mail_form .= '<label for="subject">Předmět:<br />'."\n";
$mail_form .= '<input type="text" name="subject" id="subject" ';
if (isset($_POST['subject'])) {
$mail_form .= "value=\"".$_POST['subject']."\" ";
} else {
$mail_form .= 'value="'.$initial_subject_string.'" ';
}
if (!isset($_POST['subject'])) {
$mail_form .= "onclick=\"document.forms[0].subject.value=''\" ";
}
$mail_form .= 'size="'.$subject_width.'" /></label>'."\n";
$mail_form .= '<label for="content_text">Vaše zpráva:<br />'."\n";
$mail_form .= '<textarea name="content_text" id="content_text" rows="'.$text_rows.'" cols="'.$text_cols.'">';
if (isset ($_POST['content_text'])) {
$mail_form .= $_POST['content_text'];
}
$mail_form .= '</textarea></label></p>'."\n";
$mail_form .= '<p><input type="hidden" name="send_email" value="sent" />'."\n";
$mail_form .= '<input type="submit" value="odeslat" /><input type="Reset" value="vymazat" /></p>'."\n";
$mail_form .= '</form>'."\n";
$mail_form .= '<p>Na tlačítko "odeslat" stačí kliknout jen jedenkrát.... Děkujeme.</p>'."\n";
if (isset($_POST['send_email']) && $_POST['send_email'] == 'sent') {
/* check e-mail variable, output errors, then send the e-mail + thank you message */
/* take a given email address and split it into the
username and domain. */
list($userName, $mailDomain) = split("@", $_POST['email']);
if (checkdnsrr($mailDomain, "MX")) {
// this is a valid email domain! -> send the mail and say thanks!
$name = $_POST['name'];
$email = $_POST['email'];
$subject = "$subject_prepend".$_POST['subject'];
$content_text = $_POST['content_text'];
$message = stripslashes($content_text);
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text; charset=windows-1250\r\n";
$headers .= "From: $name <$email>\r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "X-Mailer: Etomite PHP mailer\r\n";
mail ($address_to, $subject, $message, $headers);
$output = '';
$output .= $email_sent_msg;
return $output;
} else {
/* return an error and add the form */
$output = '';
$output .= '<p class="error">Promiňte, zadal jste chybný mail. Opravte jej a zprávu znovu odešlete. Děkujeme.</p>';
$output .= $mail_form;
return $output;
}
} else {
/* return an html e-mail form */
$output = '';
$output .= $mail_form;
return $output;
}
- _rasel^
- ETOMITE Admin
- Príspevky: 1122
- Dátum registrácie: Ut Sep 20, 2005 1:03 am
- Bydlisko: Košice (SR)
- Kontaktovať používateľa:
Mierne upraveny (lokalizacia + oddelenie textu od kodu) snippet ContactMe pre Etomite:Demo:
Kód: Vybrať všetko
/*Adresa prijimateľa*/
$address_to = 'email@email.sk';
/*Predpona predmetu*/
$subject_prepend = 'Etomite - ';
/*Text pred*/
$your_name = 'Vaše meno:';
$your_email = 'Váš e-mail:';
$your_subject = 'Predmet:';
$your_email_content = 'Obsah e-mailu:';
/*Text zobrazeny v poliach, ktore po kliknuti zmyznu*/
$initial_name_string = '';
$initial_email_string = '';
$initial_subject_string = '';
/*Text tlačidiel*/
$button_send = 'Poslať e-mail';
$button_reset = 'Vymazať';
$info_send = '<p>Prosím neklikajte na "Poslať e-mail" viac ako jeden-krát.</p>';
$email_error = '<p class="error"><b>Please Insert a Valid E-Mail, so that we could e-mail you back.</b></p>';
$email_charset = 'iso-8859-1';
/*Rozmery poli*/
$name_width = '40';
$email_width = '40';
$subject_width = '40';
$text_cols = '40';
$text_rows = '5';
/*Sprava po odoslani e-mailu*/
$email_sent_msg = '<b>Ďakujem za Váš e-mail!</b>'."\n";
$email_sent_msg .= "<p>Váš e-mail bol úspešne odoslaný! Odpoviem naňho čo najskôr ako bude možné.</p>"."\n";
/* ------------------------------------------------------*/
/* Don't mess with this unless you know what ur doing!!! */
/* This is the actual code... */
/* ------------------------------------------------------*/
$mail_form = '';
$mail_form .= '<form action="" method="post" id="contact_me">'." \n ";
$mail_form .= '<table style="margin: 0px;"><tr><td><label for="name">'.$your_name.'</label></td><td>'." \n ";
$mail_form .= '<input type="text" name="name" id="name"';
if (isset($_POST['name'])) {
$mail_form .= " value=\"".$_POST['name']."\"";
}
else {
$mail_form .= ' value="'.$initial_name_string.'"';
}
if (!isset($_POST['name'])) {
$mail_form .= " onclick=\"document.forms[0].name.value=''\" ";
}
$mail_form .= 'size="'.$name_width.'" /></td></tr>'." \n";
$mail_form .= '<tr><td><label for="email">'.$your_email.'</label></td><td>'." \n";
$mail_form .= '<input type="text" name="email" id="email" ';
if (isset($_POST['email'])) {
$mail_form .= "value=\"".$_POST['email']."\" ";
} else {
$mail_form .= 'value="'.$initial_email_string.'" ';
}
if (!isset($_POST['email'])) {
$mail_form .= "onclick=\"document.forms[0].email.value=''\" ";
}
$mail_form .= 'size="'.$email_width.'" /></td></tr>'."\n";
$mail_form .= '<tr><td><label for="subject">'.$your_subject.'</label></td><td>'."\n";
$mail_form .= '<input type="text" name="subject" id="subject" ';
if (isset($_POST['subject'])) {
$mail_form .= "value=\"".$_POST['subject']."\" ";
} else {
$mail_form .= 'value="'.$initial_subject_string.'" ';
}
if (!isset($_POST['subject'])) {
$mail_form .= "onclick=\"document.forms[0].subject.value=''\" ";
}
$mail_form .= 'size="'.$subject_width.'" /></td></tr>'."\n";
$mail_form .= '<tr><td><label for="content_text">'.$your_email_content.'</label></td><td>'."\n";
$mail_form .= '<textarea name="content_text" id="content_text" rows="'.$text_rows.'" cols="'.$text_cols.'">';
if (isset ($_POST['content_text'])) {
$mail_form .= $_POST['content_text'];
}
$mail_form .= '</textarea></td></tr>'."\n";
$mail_form .= '<tr><td> </td><td><input type="hidden" name="send_email" value="sent" />'."\n";
$mail_form .= '<input type="submit" value="'.$button_send.'" /> <input type="reset" value="'.$button_reset.'" /></td></tr></table>'."\n";
$mail_form .= '</form>'."\n";
$mail_form .= $info_send;
if (isset($_POST['send_email']) && $_POST['send_email'] == 'sent') {
/* check e-mail variable, output errors, then send the e-mail + thank you message */
/* take a given email address and split it into the
username and domain. */
list($userName, $mailDomain) = split("@", $_POST['email']);
if (checkdnsrr($mailDomain, "MX")) {
// this is a valid email domain! -> send the mail and say thanks!
$name = $_POST['name'];
$email = $_POST['email'];
$subject = "$subject_prepend".$_POST['subject'];
$content_text = $_POST['content_text'];
$message = stripslashes($content_text);
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text; charset='.$email_charset.'\r\n";
$headers .= "From: $name <$email>\r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "X-Mailer: Etomite PHP mailer\r\n";
mail ($address_to, $subject, $message, $headers);
$output = '';
$output .= $email_sent_msg;
return $output;
} else {
/* return an error and add the form */
$output = '';
$output .= $email_error;
$output .= $mail_form;
return $output;
}
} else {
/* return an html e-mail form */
$output = '';
$output .= $mail_form;
return $output;
}
Kód: Vybrať všetko
http://www.rasel.atknet.sk/e-mail
..:: Etomite CMS → Rulezzz !.!.!. ::..
- _rasel^
- ETOMITE Admin
- Príspevky: 1122
- Dátum registrácie: Ut Sep 20, 2005 1:03 am
- Bydlisko: Košice (SR)
- Kontaktovať používateľa:
Myslíš: Že ak niekto do poľa mailu odosielateľa nezadá mail s českou koncovkou, tak mail neodošle a vyhodí chybovú hlášku?
..:: Etomite CMS → Rulezzz !.!.!. ::..
-
- Light Expert
- Príspevky: 27
- Dátum registrácie: Ut Sep 20, 2005 10:04 pm
- Kontaktovať používateľa:
ano, přesně tak. zkoušel jsem to s koncovkou .info a vyhazuje to chybu_rasel^ napísal:Myslíš: Že ak niekto do poľa mailu odosielateľa nezadá mail s českou koncovkou, tak mail neodošle a vyhodí chybovú hlášku?
Kód: Vybrať všetko
Prosím vložte platnou e-mailovou adresu, abych Vám mohl odpovědět.
- _rasel^
- ETOMITE Admin
- Príspevky: 1122
- Dátum registrácie: Ut Sep 20, 2005 1:03 am
- Bydlisko: Košice (SR)
- Kontaktovať používateľa:
Ak chce niekto v snippete používať diakritiky vrátane diakritiky v hlavičke samotného mailu [znaková sada UTF-8], tak treba kód upraviť na:
Kód: Vybrať všetko
$message = base64_encode($message);
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/plain; charset=\"UTF-8\"\n";
$headers .= "Content-Transfer-Encoding: base64\n";
$headers .= "From: meno <moj@mail.sk>\n";
$headers .= "Reply-To: meno <moj@mail.sk>\n";
$subject = "=?utf-8?B?".base64_encode($subject)."?=";
mail ($address_to, $subject, $message, $headers);
..:: Etomite CMS → Rulezzz !.!.!. ::..
- _rasel^
- ETOMITE Admin
- Príspevky: 1122
- Dátum registrácie: Ut Sep 20, 2005 1:03 am
- Bydlisko: Košice (SR)
- Kontaktovať používateľa:
Tiež mám podobný problém. Vyriešiť by sa to dalo pomocou Captcha obrázku, boti vedia čítať, ale sú našťastie slepý.
Riešenie:
Pridať riadky do mail formu:Riadok podmienky:... nahradiť za:
Demo: http://www.etomite.sk/kontakt#mail
Riešenie:
Pridať riadky do mail formu:
Kód: Vybrať všetko
$mail_form .= $etomite->getCaptchaCode() . "<br />\n";
$mail_form .= "<input type=\"text\" id=\"captcha\" name=\"captcha\" value=\"\" /> « Bezpečnostný kód (<em>zadajte presne a odzadu!</em>)<br />";
Kód: Vybrať všetko
if (checkdnsrr($mailDomain, "MX")) {
Kód: Vybrať všetko
if (checkdnsrr($mailDomain, "MX") && $etomite->validCaptchaCode(strrev($_POST['captcha']))) {
Naposledy upravil/-a _rasel^ v So Feb 03, 2007 3:01 pm, upravené celkom 1 krát.
..:: Etomite CMS → Rulezzz !.!.!. ::..
- _rasel^
- ETOMITE Admin
- Príspevky: 1122
- Dátum registrácie: Ut Sep 20, 2005 1:03 am
- Bydlisko: Košice (SR)
- Kontaktovať používateľa:
Tak toto je už sila. Mam captcha obrázok a dnes mi došiel 2x pamm (boti používajú OCR)...
Musím niečo iné vymyslieť.
Edit: Upravil som predchádzajúci post. Kód sa bude zadávať odzadu! V Etomite managery (Konfigurácia Etomite - Užívateľské - CAPTCHA Slová:) odporúčam dať nejaké kratšie captcha reťazce...
Musím niečo iné vymyslieť.
Edit: Upravil som predchádzajúci post. Kód sa bude zadávať odzadu! V Etomite managery (Konfigurácia Etomite - Užívateľské - CAPTCHA Slová:) odporúčam dať nejaké kratšie captcha reťazce...
..:: Etomite CMS → Rulezzz !.!.!. ::..
- _rasel^
- ETOMITE Admin
- Príspevky: 1122
- Dátum registrácie: Ut Sep 20, 2005 1:03 am
- Bydlisko: Košice (SR)
- Kontaktovať používateľa:
Tak tu je môj kompletný snippet.
- Je upravený iba pre UTF-8 (obsah a predmet e-mailu).
Kód: Vybrať všetko
$email_charset = 'utf-8'; ... $subject = "=?utf-8?B?" . base64_encode($subject) . "?=";
- Obsahuje overovanie pomocou CAPTCHA obrázku, odzadu!
- Obsah e-mailu sa naformátuje podľa:... čiže bude vyzerať takto:
Kód: Vybrať všetko
$content_texts = "<!--\nName: " . $name . "\nE-mail: " . $email . "\nSubject: " . $_POST['subject'] . "\nIP: " . $_SERVER['REMOTE_ADDR'] . "\nDate: " . date('m.d.Y H:m:s') . "\n-->\n\nContent:\n--------\n\n " . $content_text . "\n\n--\nFrom Etomite Mail Form";
Kód: Vybrať všetko
<!-- Name: Your Name E-mail: your@email.com Subject: Subject IP: 88.212.21.31 Date: 05.07.2007 07:05:35 --> Content: -------- Text e-mailu. -- From Etomite Mail Form
- Stránka na ktorej je umiestnený snippet nesmie byť ukladaná do cache!
- Prílohy
-
- contact-me.rar
- (1.65 KiB) 653 stiahnutí
..:: Etomite CMS → Rulezzz !.!.!. ::..
- _rasel^
- ETOMITE Admin
- Príspevky: 1122
- Dátum registrácie: Ut Sep 20, 2005 1:03 am
- Bydlisko: Košice (SR)
- Kontaktovať používateľa:
Pri Win-1250 je to nepodstatné... kľudne to uprav na:
Kód: Vybrať všetko
$message = $content_texts;
..:: Etomite CMS → Rulezzz !.!.!. ::..