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?
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
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.
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?
class MyDO extends DataObject {
function onBeforeWrite() {
parent::onBeforeWrite();
$email = new Email();
$email->sendPlain();
}
}
Thanks!
Further refinement: is it possible to have it send that email only when a certain specific database field is changed?
yes, check out this method...
http://api.silverstripe.org/2.3/sapphire/model/DataObject.html#methodgetChangedFields