Adding function to create custom emails in controller