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.

General Questions /

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

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

Email on alteration to dataobject in CMS?


Go to End
Reply


4 Posts   474 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, 245 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, 1826 Posts

3 November 2011 at 11:39pm