{MailForm} in your page where the mail form should appear."; /** Constructor. */ function MailForm() { $this->declareParam('email', ''); $this->declareParam('title', ''); $this->declareParam('subject_tag', '[web form]'); } /** Show an instance of the MailForm plugin. */ function show() { global $page; // get parameters $to_email = $this->getParamValue('email'); $form_title = $this->getParamValue('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->getParamValue('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 .= '