implemented sendgrid email function