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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Email on alteration to dataobject in CMS?


Go to End


4 Posts   925 Views

Avatar
JonC

Community Member, 8 Posts

2 November 2011 at 4:13pm

Hi, guys.

Question: is it possible to have SS send an email to an email address stored in a particular DataObject when that DataObject is altered and then saved in the CMS?

Avatar
Devlin

Community Member, 344 Posts

2 November 2011 at 9:17pm

class MyDO extends DataObject {
	function onBeforeWrite() {
		parent::onBeforeWrite();
		
		$email = new Email();
		$email->sendPlain();
	}
}

http://doc.silverstripe.org/sapphire/en/topics/datamodel

Avatar
JonC

Community Member, 8 Posts

3 November 2011 at 7:51pm

Thanks!

Further refinement: is it possible to have it send that email only when a certain specific database field is changed?

Avatar
swaiba

Forum Moderator, 1899 Posts

3 November 2011 at 11:39pm