PPPoE disconnected Script email & telegram

Dear Experts

I’m running a PPPoE server. I need a script.
I want it when my users disconnected it sends me an email or telegram which included the names of the users and the downloaded traffic per user.