Had to get a site up and use a contact field:
Its not a beauty but it works
class ContactPage_Controller extends Page_Controller {
function Form() {
return new Form($this, "Form", new FieldSet(
// List the your fields here
new TextField("FullName", "FullName"),
new EmailField("Email", "Email address"),
new TextField("Telephone", "Telephone"),
new TextField("Address", "Address"),
new TextField("Postcode", "Postcode"),
new TextField("Country", "Country"),
new TextField("Comments", "Comments")
), new FieldSet(
// List the action buttons here
new FormAction("doform", "Send")
), new RequiredFields(
// "FullName","Email"// List the required fields here: "Email", "FirstName"
));
}
function doform($data, $form) {
mail ('your@domain.tld','new contactform Entry', "
Fullname: $data[FullName]
Email: $data
Telephone: $data[Telephone]
Address: $data[Address]
Postcode: $data[Postcode]
Country: $data[Country]
Comments: $data[Comments]
");
// Redirect to a page thanking people for emailing
Director::redirect('thanks-for-emailing/');
}
}