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.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

UserForms: sending custom messages incl. variables

Go to End

2 Posts   2065 Views


Community Member, 7 Posts

18 August 2010 at 12:40am


We're searching for a method to send custom messages after filling in a form, using the fields of the form in the message (for example, tell-a-friend messages).

Currently there seems to be no way of doing this with UserForms. It is possible to make a custom message in the tab "Email Recipients", but there is no way to use the information from the form itself. I would like to see some way to use the fields in messages like this:

"Dear $NameTo,
foo foo foo
$NameFrom ($EmailFrom)"

It would be nice to get a checkbox too where you can define whether or not you want to get the whole form content glued beneath the body.

Will it be possible to implement such a function in one of the next releases? Are there some other ideas to get this functionality until the UserForms module supports this?



Community Member, 115 Posts

18 August 2010 at 9:19am

Hi Martiman,

This is easy to do if you code the form yourself.

Basically - create a new page type for your form:


and in MyFormPage_Controller() {

you should define a form function:

function Form() {

Go here for details on the form function


In your submit function, all your form variables will be available to send in the email in the following way:

$data["Email"] etc

So in the form function you could do something like the following:

	function submit($data, $form) {
	$email = new Email;
	$email->to = [email protected]';
	$email->from = [email protected]';
	$email->subject = 'New Referral';
	$email->body = "Hi,<br /><br />There has been a blah blah blah from  " . $data['FirstName'] . " " . $data['LastName'] . " through the website!";

	// Redirect


// This code may not be perfect I had to cut a lot of sensitive data out!!!