FIXED send mail function and email templates