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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

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

Personalized Email UserForms


Go to End


1486 Views

Avatar
ragunalth

Community Member, 14 Posts

2 July 2010 at 7:25am

To send personalized emails using user form add the following code to append to the body.

foreach($emailData['Fields'] as $Field)
  $body = preg_replace('#\b'.$Field->Name.'(|\b)#u', $Field->Value, $body);
}

Add the relevant text field in the body of the email under email recipients. Example

Hi EditableTextField2
Thanks for sending me an email. 
Kind Regards
EditableTextField1

Result

Hi Paul
Thanks for sending me an email.
Kind Regards
John