public async Task SendNewCommentEmail(CommentVM comment,int teamId)
        {
            var subscribers = await userRepository.GetSubscribers(teamId, NotificationTypeCode.NewComment);

            var emailTemplate =  emailTemplateRepository.GetEmailTemplate("NewComment");
            if (emailTemplate != null)
            {
                string emailSubject = emailTemplate.Subject;
                string emailBody = emailTemplate.EmailBody;
                Email email = new Email();
               
              
                string issueUrl = UrlBuilderHelper.SiteBaseUrl + "issues/" + comment.IssueId;
                var issueLink = "<a href='" + issueUrl + "'>" + "# " + comment.IssueId + " " + comment.IssueId + "</a>";
                emailBody = emailBody.Replace("@author", comment.Author.Name);
                emailBody = emailBody.Replace("@link", issueLink);
                emailBody = emailBody.Replace("@comment", comment.CommentBody);
                emailBody = emailBody.Replace("@issueId", comment.IssueId.ToString());
                email.Body = emailBody;
                emailSubject = emailSubject.Replace("@issueId", comment.IssueId.ToString());
                email.Subject = emailSubject;

                foreach (var subscriber in subscribers)
                {
                    email.ToAddress.Add(subscriber.EmailAddress);
                }

                email.Send();
            }
        }
 public void SendNewAccountCreatedEmail(User user)
 {
     var emailTemplate = repo.GetEmailTemplate("NewAccount");
     if (emailTemplate != null)
     {
         string emailSubject = emailTemplate.EmailSubject;
         string emailBody = emailTemplate.EmailBody;
         Email email = new Email();
         email.ToAddress.Add(user.EmailAddress);
       
         emailBody = emailBody.Replace("@userName", user.FirstName);
         email.Body = emailBody;
         email.Subject = emailSubject;
         email.Send();
     }
 }
        public void SendResetPasswordEmail(UserAccountDto userAccount,string activationLink)
        {
            var emailTemplate = repository.GetEmailTemplate("ResetPassword");
            if (emailTemplate != null)
            {
                string emailSubject = emailTemplate.Subject;
                string emailBody = emailTemplate.EmailBody;
                Email email = new Email();
                email.ToAddress.Add(userAccount.EmailAddress);

                string joinLink = $"{UrlBuilderHelper.SiteBaseUrl}Account/resetpassword/{activationLink}";
                emailBody = emailBody.Replace("@resetLink", joinLink);
                email.Body = emailBody;
                email.Subject = emailSubject;
                email.Send();
            }
        }
        public void SendResetPasswordEmail(PasswordResetRequest request)
        {
            var emailTemplate = repo.GetEmailTemplate("ResetPassword");
            if (emailTemplate != null)
            {                

                string emailSubject = emailTemplate.EmailSubject;
                string emailBody = emailTemplate.EmailBody;
                Email email = new Email();
                email.ToAddress.Add(request.User.EmailAddress);

                string joinLink = String.Format("{0}Account/resetpassword/{1}", SiteBaseURL, request.ActivationCode);
                emailBody = emailBody.Replace("@resetLink", joinLink);              
                email.Body = emailBody;
                email.Subject = emailSubject;
                email.Send();
            }


        }
        public void SendJoinMyTeamEmail(TeamMemberRequest teamMemberRequest)
        {    
            var emailTemplate = repo.GetEmailTemplate("JoinMyTeam");
            if (emailTemplate != null)
            {
                teamMemberRequest = repo.GetTeamMemberRequest(teamMemberRequest.ActivationCode);

                string emailSubject = emailTemplate.EmailSubject;
                string emailBody = emailTemplate.EmailBody;
                Email email = new Email();
                email.ToAddress.Add(teamMemberRequest.EmailAddress);

                
                string joinLink = String.Format("{0}Account/Join?returnurl={1}", SiteBaseURL, teamMemberRequest.ActivationCode);
                emailBody = emailBody.Replace("@teamName", teamMemberRequest.Team.Name);
                emailBody = emailBody.Replace("@joinUrl", joinLink);
                emailBody=emailBody.Replace("@inviter", teamMemberRequest.User.FirstName);
                email.Body = emailBody;
                email.Subject=emailSubject;
                email.Send();
            }


        }