{MailForm} in your page where the mail form should appear."; /** Plugin parameters */ var $params = array('email' => '', 'title' => '', 'subject_tag' => '[web form] '); /** Show an instance of the MailForm plugin. */ function show() { global $page; // get params $to_email = $this->params['email']; $form_title = $this->params['title']; if (!isvalid_email($to_email)) { return '

You must specify a valid e-mail in the "email" parameter to make use of the MailForm plugin.

'; } // get input $action = clean_request('action'); $from = clean_request('from'); $refer = strip_request('refer'); if (!$refer) $refer = $_SERVER['HTTP_REFERER']; $message = strip_request('message'); $subject = strip_request('subject'); $showform=0; $output = ''; switch($action) { case "mail": if ((!$subject)||(!$message)||(!$from)) { $output .= '

Missing fields !

'; $showform=1; break; } if (!isvalid_email($from)) { $output .= '

Invalid email address !

'; $showform=1; break; } $mymail = new HermesMailer(); $mymail->setFrom($from); $mymail->setSubject($this->params['subject_tag'].$subject); $mymail->addTo($to_email); $mymail->setTxtBody($message); $mymail->send(); $output .= '

Message sent !

'; if ($refer!="") { $output .= '

To return to referring web page click here

'; } break; default: $showform=1; } if ($showform) { $output .= '
'.$form_title.'
'.__("from").'
'.__("subject").'
'.__("message").'
 
'; } return $output; } } ?>