extracted the logic to send the email to the service