I did this! A long term, on-again off-again, drama filled relationship that stretched from middle school through college. I had to get off the merry-go-round, so my last year of college, I cut him off completely and very dramatically, and refused even to talk to him anymore. Not handled maturely, for sure, but it was honestly the best thing for us, we both grew up and moved on.
But - I was very close with his family back in the day, and when I learned in my late 20s that his father had died, I reached out (via Facebook Messenger, didn't have another way) and just sent him something to the effect of "I know we haven't talked in a long time, and I know that's my fault, so I apologize if this message is poorly received, but I heard your father died, and I wanted to send along my condolences. He was such a wonderful guy. I remember..." and then shared a couple of very nice memories from our childhood.
He send me a message back that was very gracious and grateful, and I could tell it meant a lot to him. We went back and forth with a short life update after that, and now every year, I send a donation when he does his annual "race for the cure" for the disease his dad died of, and he sends me a thank you, and that's that.
I think the key things for me in doing it was 1) I 100%, no reservations, had no romantic feelings left for him, and was confident the same for him. It had been probably 7 years since we'd talked, and he was married, 2) related to point 1, if he had never responded, or even had responded in anger, I still would have felt good about what I did - considering all possible outcomes is smart, 3) I put the shoe on the other foot, and realized I would have been so touched to hear from him in the same way if something happened to my dad. I think a big reason for that is, objectively, we knew each other's dad's really well and spent a lot of time with them.