mirror of
https://github.com/silverstripe/silverstripe-frameworktest
synced 2024-10-22 11:06:02 +02:00
Added test email function to frameworktests
This commit is contained in:
parent
1df4995f00
commit
5d64c572e9
@ -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>";
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Reference in New Issue
Block a user