I want to send an email if/when an entry is saved with a lightswitch switched on after previously being off.
I have the below code in my plugin's init file, but I don't know how to
check for the section uid and verify that it's the right section or
check the previous value and compare it to the value being saved.
Craft::$app->elements->on(Elements::EVENT_AFTER_SAVE_ELEMENT, function(ElementEvent $e) {
$element = $e->element;
});
I'd appreciate any help, thanks.