added function to send emails for invitation