Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Email workaround


Reply


2 Posts   1842 Views

Avatar
someonlinedude

Community Member, 11 Posts

1 March 2007 at 3:59am

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/');
}

   
}

Avatar
Sigurd

Forum Moderator, 628 Posts

15 March 2007 at 9:27pm

Hey would love to see the site URL in showcase sites forum if you're happy to show it off :)