Added test email function to frameworktests

This commit is contained in:
Sam Minnee 2009-08-25 05:49:13 +00:00
parent 1df4995f00
commit 5d64c572e9

View File

@ -80,5 +80,31 @@ class TestPage_Controller extends Page_Controller {
if($depth > 1) $this->makePages($count, $depth-1, $prefix."$i.", $page->ID);
}
}
function EmailForm() {
return new Form($this, "EmailForm", new FieldSet(
new TextField("Email", "Email address")
), new FieldSet(
new FormAction("sendEmail", "Send test email to this address")
));
}
function email() {
return array(
'Content' => '<p>Use this form to send a test email</p>',
'Form' => $this->EmailForm()
);
}
function sendEmail($data, $form) {
$email = new Email();
$email->setTo($data['Email']);
$email->setFrom($data['Email']);
$email->setSubject('A subject with some umlauts: öäüß');
$email->setBody('A body with some umlauts: öäüß');
$email->send();
echo "<p>email sent to " . $data['Email'] . "</p>";
}
}
?>