Hi, good jobs for SS!
BTW. I'm from Poland (Europa).. ;)
---
I add contact form with by http://www.ssbits.com/creating-a-simple-contact-form/
I add all source, send mail not working...
Pleas look for my official website: http://dan-tom.net , and look for this link: http://dan-tom.net/kontakt
When I send email in this page, contact form not send mail for my inbox (mail)...
Try it.
This is my ContactPage.php:
<?php
/* *****************
* Model
******************/
class ContactPage extends Page
{
static $db = array(
'Mailto' => 'kontakt@dan-tom.net', //Email address to send submissions to
'SubmitText' => 'HTMLText' //Text presented after submitting message
);
//CMS fields
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.OnSubmission", new TextField('Mailto', 'Email submissions to'));
$fields->addFieldToTab("Root.Content.OnSubmission", new HTMLEditorField('SubmitText', 'Text on Submission'));
return $fields;
}
}
/* *****************
* Controller
******************/
class ContactPage_Controller extends Page_Controller
{
function ContactForm() {
// Create fields
$Params = Director::urlParams();
$fields = new FieldSet(
new TextField('Name', 'Name*'),
new EmailField('Email', 'Email*'),
new TextareaField('Comments','Comments*')
);
// Create action
$actions = new FieldSet(
new FormAction('SendContactForm', 'Send')
);
// Create action
$validator = new RequiredFields('Name', 'Email', 'Comments');
return new Form($this, 'ContactForm', $fields, $actions, $validator);
}
function SendContactForm($data) {
//Set data
$From = $data['Email'];
$To = $this->Mailto;
$Subject = "Website Contact message";
$email = new Email($From, $To, $Subject);
//set template
$email->setTemplate('ContactEmail');
//populate template
$email->populateTemplate($data);
//send mail
$email->send();
//return to submitted message
Director::redirect(Director::baseURL(). $this->URLSegment . "/?success=1");
}
public function Success()
{
return isset($_REQUEST['success']) && $_REQUEST['success'] == "1";
}
}
Pleas, help me today. :)
greet, Dan-Tom.