=====Feedback Action===== [''Note: The feedback action is now included in Wikka by default starting with Wikka 1.1.3.1''] <tag.'&mail=result"> Name:
Email:
Comments:

'; if ($_GET["mail"]=="result") { $name = $_POST["name"]; $email = $_POST["email"]; $comments = $_POST["comments"]; list($user, $host) = sscanf($email, "%[a-zA-Z0-9._-]@%[a-zA-Z0-9._-]"); if (!$name) { // a valid name must be entered echo "

Please enter your name

"; echo $form; } elseif (!$email || !strchr($email, "@") || !$user || !$host) { // a valid email address must be entered echo "

Please enter a valid email address

"; echo $form; } elseif (!$comments) { // some text must be entered echo "

Please enter some text

"; echo $alert; echo $form; } else { // send email and display message $msg = "Name:\t".$name."\n"; $msg .= "Email:\t".$email."\n"; $msg .= "Comments:".$comments."\n"; $recipient = $this->GetConfigValue("admin_email"); $subject = "Feedback from ".$this->GetConfigValue("wakka_name"); $mailheaders = "From:".$email."\n"; $mailheaders .= "Reply-To:".$email."\n\n"; mail($recipient, $subject, $msg, $mailheaders); echo $this->Format("Thanks for your interest! Your feedback has been sent to [[".$recipient."]] ---"); echo $this->Format("Return to the [[".$this->GetConfigValue("root_page")." | main page]]"); // optionally displays the feedback text //echo $this->Format("---- **Name:** ".$name."---**Email:** ".$email."---**Comments:** ---".$comments); } } else { echo $form; } ?> %% with some simple modifications this form can be used to send a mail to any registered user. the idea is to use either a given parameter "to" or the page-tag to fetch the mail-address out of the wakka_users table replace the line **""$recipient = $this->GetConfigValue("admin_email");""** with the following: %%(php) if (!$to) $to = $this->tag; $record = $this->LoadUser($to); if ($recipient = $record["email"]) { // proceed with mailing } else echo "

Sorry, can't address recipient

"; %% after saving the modified code as **mail.php** in the actions folder, you can address me with the action ""{{mail to="DreckFehler"}}"" or simply place a ""{{mail}}"" onto your personal userpage to have a contact-form without publishing your email-address (don't echo the address in the tnx-message ;) this should rather be changed to "...your feedback has been sent to ""[[".$to."]] ---"""). -- DreckFehler -- === Bug found! === There is a bug in the feedback action when this is used on wikka installations that don't adopt rewriterules. The submit button currently posts the form to: ##$this->tag.'?mail=result'## which opens an invalid URL if rewrite_mode is set to "0" in ##wikka.config.php##. The form should be posted instead to: ##$this->tag.'&mail=result'## ''Note: this should work in any case, whether rewrite_mode is set to "0" or "1"'' I've fixed the code above.