Fixing deleted mail template accesing settings variable
Added some validation on name