Added e-mail script. Please test it.

I added the e-mail script. It is similar to the DALIS one. Please test it and let me know whether it works or not. I can make any changes later.
There is a lot of stuff here that is not related. such as this died function.

Please clean up the code.