I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
30+ years of tech, retired from an identity intelligence company, now part-time with an insurance broker.
Dev community mod - mostly light gardening & weeding out spam :)
If you're using it as an optional field, why not just have a "send test notification" action available?
If it needs to be valid for any other reason (like proving someone's identity) then it's probably a forlorn hope anyway.
This - close the loop at the next layer up if possible, typically seen in registration systems that send a confirmation link.