validateAndSend() ) { $this->echoln("

Your mail has been sent to the webmaster.

"); }else { $this->showForm(); } } private function validateAndSend() { $valid = true; if( strlen($_POST['name']) < 3 ) { $this->echoln("Please provide your name.
"); $valid = false; } if( strlen($_POST['email']) < 3 || !Mail::checkEmail($_POST['email']) ) { $this->echoln("Please provide a valid e-mail address.
"); $valid = false; } if( strlen($_POST['subject']) < 10 ) { $this->echoln("Please provide a subject.
"); $valid = false; } if( strlen($_POST['message']) < 16 ) { $this->echoln("Please provide a message.
"); $valid = false; } if( $valid ) { $mail = new Mail(WEBMASTER_MAIL, WEBMASTER_MAIL); $mail->setSubject($_POST['subject']); $mail->addHeader("From", "\"Photomaster AEGEE-Europe\" <" . WEBMASTER_MAIL . ">"); $mail->addHeader("Reply-To", "\"" . $_POST['name'] . "\" <" . $_POST['email'] . ">"); $mail->addHeader("To", "\"Photomaster AEGEE-Europe\" <" . WEBMASTER_MAIL . ">"); $mail->setMessage(str_replace("\r\n", "\n", $_POST['message'])); if( $mail->send() == Mail::MAIL_OK ) { return true; }else { $this->echoln("Failed sending mail to webmaster.

"); return false; } }else { $this->echoln("

"); return false; } } private function showForm() { $this->echoln("
"); $this->echoln(" "); $this->echoln(" "); $this->echoln(" "); $this->echoln(" "); $this->echoln(" "); $this->echoln(" "); $this->echoln(" "); $this->echoln(" "); $this->echoln(" "); $this->echoln(" "); $this->echoln(" "); $this->echoln(" "); $this->echoln(" "); $this->echoln(" "); $this->echoln(" "); $this->echoln(" "); $this->echoln(" "); $this->echoln(" "); $this->echoln(" "); $this->echoln(" "); $this->echoln(" "); $this->echoln(" "); $this->echoln(" "); $this->echoln("
Send an e-mail to the webmaster
Your name:
Your e-mail:
Subject:
Message:

 
"); $this->echoln("
"); } } ?>