Hotspot Login Logout Script

Hello,
i need help to send me a Email wen a hotspot user logof with the User,IP,Mac.
wenn the User logoff i need to recive User,IP,Mac,Up and Download, Uptime.

how i can make it? some example?
thanks