Added functionality to send messages and emails