Hi there,
I've been looking around the forum all day and so far i haven't been able to come up with a solution, i want to have a button on the screen that when clicked runs a function that is set to email instructions to an email group, i have most of it done but i don't seem to be able to make a button run the function. My code is below, as ever would welcome some pointers or even the answer :o)
function EmailSearchTeam() {
return new Form($this, '', new FieldSet(new HiddenField('Hidden')), new FieldSet(new FormAction('doEmailSearchTeam', 'Email the Team')));
}
function doEmailSearchTeam() {
$email = new Email();
$email->setTemplate('TestEmail');
$email->setFrom('xxxx@xxxxx.com');
$email->setTo('yyyyyy@yyyyyy.com');
$email->setSubject('New Event Added ');
$email->populateTemplate(Member::currentUser());
$email->populateTemplate(array(
'Title' => $this->owner->Title,
'Date' => $this->owner->StartDate,
'StartTime' => $this->owner->StartTime,
'Location' => $this->owner->Location,
'Contact1' => $this->owner->Contact1,
));
$email->send();
}
Sorry should add, there are no errors it all looks like it works but no email is sent, i'm wondering whether you can actually call a function like this.
Hope someone can help.
regards
Mick