From 5d64c572e932d80f61045e954518398c50921bd4 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 25 Aug 2009 05:49:13 +0000 Subject: [PATCH] Added test email function to frameworktests --- code/TestPage.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/code/TestPage.php b/code/TestPage.php index 9a25bd6..dd1061f 100644 --- a/code/TestPage.php +++ b/code/TestPage.php @@ -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' => '

Use this form to send a test email

', + '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 "

email sent to " . $data['Email'] . "

"; + } } ?> \ No newline at end of file