Sort of working...

Fixed some stuff and tested locally, now the code executes the `mail()` call without raising any notice.