Listening for Change at Entry Save 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-&gt;elements-&gt;on(Elements::EVENT_AFTER_SAVE_ELEMENT, function(ElementEvent $e) {
            $element = $e-&gt;element;
            
            
    
        });

I'd appreciate any help, thanks.
I believe you're looking for this instead.
Event::on(
    Entry::class,
    Element::EVENT_AFTER_SAVE,
    static function (ModelEvent $event) {
        $entry = $event-&gt;sender;
        if ($entry-&gt;status === 'disabled'
            &amp;&amp; $entry-&gt;propagating
            &amp;&amp; $entry-&gt;resaving
            &amp;&amp; ElementHelper::isDraftOrRevision($entry)) {
            return; // do nothing if disabled/draft/resaving...
        }
        if ($entry-&gt;section-&gt;handle === 'my-handle') { // check section handle
            // call your preferred msg client: slack, email, mailgun...
        }
    }
);