Example #1
0
        public async Task AdminRegMessage(User result)
        {
            var body = new StringBuilder();

            result.Password = EncryptionDecryptionHelper.DecryptString(result.Password);
            body.AppendFormat("Hello " + result.FirstName + " , <br /><br />");
            body.Append(Environment.NewLine);
            body.AppendLine("You have been registered to access EAP Admin Portal <br />");

            body.AppendLine("Please find below your login details<br /><br />");
            string emailLink = $"<a href={ _appurl }>click here</a>";

            body.AppendLine($"URL to access EAP Admin: {emailLink}" + "<br />");
            body.AppendLine($"Username : {result.Email }<br />");
            body.AppendLine($"Password :  { result.Password}<br /> <br />");
            string EncryptedUserId = EncryptionDecryptionHelper.EncryptString(Convert.ToString(result.UserId));

            body.AppendLine($"Please note: we have provided auto generated password for login.Please change the Password  after first login.<br /><br />");
            body.AppendLine($"{regards}<br />");
            body.AppendLine($"{footerlink}");
            var apiKey = _config.GetSection("EmailSendGridKey").Value;
            var client = new SendGridClient(apiKey);
            var msg    = new SendGridMessage()
            {
                From             = new EmailAddress(_fromEmail, _fromEmail),
                Subject          = "EAP Admin portal",
                PlainTextContent = "",
                HtmlContent      = body.ToString(),
            };

            msg.AddTo(new EmailAddress(result.Email));

            var response = await client.SendEmailAsync(msg);
        }
Example #2
0
        public async Task SignUpVerificationEmail(User user)
        {
            var body = new StringBuilder();

            body.AppendFormat("Thanks for joining us, " + user.FirstName + ".<br /><br />");
            string EncryptedUserId = EncryptionDecryptionHelper.EncryptString(Convert.ToString(user.UserId));
            string EncodedURL      = WebUtility.UrlEncode(EncryptedUserId.Replace("+", "œ").Replace("=", "Ž").Replace("/", "ô"));

            string emailLink = $"<a style='max-width:200px;max-height:25px;text-decoration:none;display:inline-block;width:200px;height:25px;background: #1A55A6;padding: 10px 10px 10px 10px;text-align:center;border-radius:5px;color: white;font-weight: bold;line-height: 25px;' href={ _verifiedCounsellorUrl + EncodedURL }>Verify email</a>";

            body.AppendLine($"Please click the button below to confirm your email address and verify your account. Your account will give you access to our booking system and AccessChat service, as well as access to resources and check-ins to support your wellbeing and mental health through our app.<br /><br />");
            //body.AppendLine("<a href=\'"+ _forgetpasswordurl + HttpUtility.UrlEncode(EncryptedUserId) + "\">Change Password</a>");
            body.AppendLine($"{emailLink}<br /><br />");
            body.AppendLine($"{regards}<br />");
            body.AppendLine($"{footerlink}");
            var apiKey = _config.GetSection("EmailSendGridKey").Value;


            var client = new SendGridClient(apiKey);
            var msg    = new SendGridMessage()
            {
                From             = new EmailAddress(_fromEmail, _fromName),
                Subject          = user.FirstName + ", " + "please confirm your email",
                PlainTextContent = "",
                HtmlContent      = body.ToString(),
            };

            msg.AddTo(new EmailAddress(user.Email));

            var response = await client.SendEmailAsync(msg);
        }
Example #3
0
        public void localForgetMessage(User User)
        {
            string email_from   = _config["FromEmail"];
            string email_to     = User.Email;
            string email_frmpwd = _config["FromEmailPwd"];

            MailMessage objMailMessage  = new MailMessage();
            string      EncryptedUserId = EncryptionDecryptionHelper.EncryptString(Convert.ToString(User.UserId));

            objMailMessage.To.Add(new MailAddress(email_to));
            objMailMessage.From       = new MailAddress(email_from, "EAP");
            objMailMessage.Subject    = "EAP";
            objMailMessage.IsBodyHtml = true;
            var body = new StringBuilder();

            body.AppendFormat("Hello " + User.FirstName + " ,<br /><br />");
            string emailLink = $"<a href={ _forgetpasswordurl + HttpUtility.UrlEncode(EncryptedUserId) }>click here</a>";

            body.AppendLine($"Please {emailLink} to change your password.<br /><br />");
            body.AppendLine($"Regards, <br />");
            body.AppendLine($"EAP Admin <br />");
            objMailMessage.Body     = body.ToString();
            objMailMessage.Priority = MailPriority.High;
            _email.sendEmail(objMailMessage, email_from, email_frmpwd, _config);
        }
Example #4
0
        public async Task ForgetPasswordMail(User user)
        {
            var body = new StringBuilder();

            body.AppendFormat("Hi " + user.FirstName + ",<br /><br />");
            string EncryptedUserId = EncryptionDecryptionHelper.EncryptString(Convert.ToString(user.UserId));
            string EncodedURL      = WebUtility.UrlEncode(EncryptedUserId.Replace("+", "œ").Replace("=", "Ž").Replace("/", "ô"));
            string EncryptedGUID   = EncryptionDecryptionHelper.EncryptString(Convert.ToString(user.GUID));
            string EncodedGUID     = WebUtility.UrlEncode(EncryptedGUID.Replace("+", "œ").Replace("=", "Ž").Replace("/", "ô"));
            string emailLink       = $"<a style='max-width:200px;max-height:25px;text-decoration:none;display:inline-block;width:200px;height:25px;background: #1A55A6;padding: 10px 10px 10px 10px;text-align:center;border-radius:5px;color: white;font-weight: bold;line-height: 25px;' href={ _forgetpasswordurl + EncodedURL + '/' + EncodedGUID}>Reset your password</a>";

            // string emailLink = "<a class='MsoNormal' style='background-color:#1A55A6;color: #FFFFFF;border-radius: 2px;' href=https://eapaccessportal.azurewebsites.net/forgetpassword/FJdFA3%C5%93iMXAxfvbDiIonuQ%C5%BD%C5%BD/99fQc8jzzDzR2hvsV4Xj%C3%B4Bp1OnCtLl6CZvb6jFvxDAEqqWL1TOMVxb2U8X9BWxkE>Reset your password</a>";
            body.AppendLine($"You recently requested to reset the password for your AccessEAP account. Please click the button below to reset your password.<br /><br />");
            body.AppendLine($"{emailLink}<br /><br />");
            body.AppendLine($"This link is valid for the next 6 hours. If you did not request a password reset, please ignore this email. <br /><br />");
            //body.AppendLine("<a href=\'"+ _forgetpasswordurl + HttpUtility.UrlEncode(EncryptedUserId) + "\">Change Password</a>");
            body.AppendLine($"{regards}<br />");
            body.AppendLine($"{footerlink}");
            var apiKey = _config.GetSection("EmailSendGridKey").Value;


            var client = new SendGridClient(apiKey);
            var msg    = new SendGridMessage()
            {
                From             = new EmailAddress(_fromEmail, _fromName),
                Subject          = "Your AccessEAP Password Reset Request",
                PlainTextContent = "",
                HtmlContent      = body.ToString(),
            };

            msg.AddTo(new EmailAddress(user.Email));

            var response = await client.SendEmailAsync(msg);
        }
Example #5
0
        public async Task SendMailReminder(CousollerandClientDetail users)
        {
            var body = new StringBuilder();

            body.AppendFormat(users.ClientName + ", this is a friendly reminder of your upcoming appointment today.<br /><br />");


            //body.AppendLine("<a href=\'"+ _forgetpasswordurl + HttpUtility.UrlEncode(EncryptedUserId) + "\">Change Password</a>");
            if (users.ActivityType == "Scheduled Chat")
            {
                string emailLink = $"<a href={ _chatdUrl + users.ACEAppointmentId }>click here</a>";
                body.AppendLine($"Your appointment is booked at " + users.StartTime + " with " + users.CounsollerName + " via AccessChat.<br /><br />");
                body.AppendLine($"Please note, if your appointment is via Video or AccessChat, you will need to log into our portal {emailLink} to join your session. <br /><br />");
                body.AppendLine($"If you are unable to attend this appointment, please login to the booking portal  and cancel your appointment. As this is less than 24 hours before your appointment, this session will be deducted from your session allowance. We appreciate you letting us know as a courtesy to your counsellor.<br /><br />");
            }
            if (users.ActivityType == "Video")
            {
                string emailLink = $"<a href={ _vediochatdUrl + users.ACEAppointmentId }>click here</a>";
                body.AppendLine($"Your appointment is booked at " + users.StartTime + " with " + users.CounsollerName + " via Video.<br /><br />");
                body.AppendLine($"Please note, if your appointment is via Video or AccessChat, you will need to log into our portal {emailLink} to join your session. <br /><br />");
                body.AppendLine($"If you are unable to attend this appointment, please login to the booking portal  and cancel your appointment. As this is less than 24 hours before your appointment, this session will be deducted from your session allowance. We appreciate you letting us know as a courtesy to your counsellor.<br /><br />");
            }
            if (users.ActivityType == "Telephone")
            {
                body.AppendLine($"Your appointment is booked at " + users.StartTime + " with " + users.CounsollerName + " via Telephone.<br /><br />");
                body.AppendLine($"Please note, For Telephone bookings, the Counsellor will call you at the appointment time. We recommend ensuring that your phone is charged and you are in a quiet place where you can speak freely. <br /><br />");
                body.AppendLine($"If you are unable to attend this appointment, please login to the booking portal  and cancel your appointment. As this is less than 24 hours before your appointment, this session will be deducted from your session allowance. We appreciate you letting us know as a courtesy to your counsellor.<br /><br />");
            }
            if (users.ActivityType == "Face to Face")
            {
                body.AppendLine($"Your appointment is booked at " + users.StartTime + " with " + users.CounsollerName + ". The location of your appointment is " + users.Location + ".<br /><br />");
                body.AppendLine($"If you are unable to attend this appointment, please login to the booking portal  and cancel your appointment. As this is less than 24 hours before your appointment, this session will be deducted from your session allowance. We appreciate you letting us know as a courtesy to your counsellor.<br /><br />");
            }

            body.AppendLine($"{regards}<br />");
            body.AppendLine($"{footerlink}");
            var body1 = new StringBuilder();

            body1.AppendFormat("Hi " + users.CounsollerName + ",<br /><br />");
            if (users.IsForFamilyMember)
            {
                body1.AppendLine($"Gentle reminder for Your " + users.ActivityType + "  appointment is scheduled for " + users.startDateInString + "  " + users.StartTime + " with " + users.FMFirstName + ".<br /><br />");
            }
            else
            {
                body1.AppendLine($"Your " + users.ActivityType + "  appointment is scheduled for " + users.startDateInString + "  " + users.StartTime + " with " + users.ClientName + ".<br /><br />");
            }
            if (users.ActivityType == "Scheduled Chat")
            {
                string emailLink = $"<a href={ _chatdConUrl + users.ACEAppointmentId }>click here</a>";

                body1.AppendLine($"Please {emailLink}  to chat.<br /><br />");
            }
            if (users.ActivityType == "Video")
            {
                string emailLink = $"<a href={ _vediochatdConUrl + users.ACEAppointmentId }>click here</a>";

                body1.AppendLine($"Please {emailLink}  to video chat.<br /><br />");
            }

            //body.AppendLine("<a href=\'"+ _forgetpasswordurl + HttpUtility.UrlEncode(EncryptedUserId) + "\">Change Password</a>");
            body1.AppendLine($"{regards}<br />");
            body1.AppendLine($"{footerlink}");
            var body2 = new StringBuilder();

            body2.AppendFormat(users.FMFirstName + ", this is a friendly reminder of your upcoming appointment today.<br /><br />");
            string EncryptedUserId         = EncryptionDecryptionHelper.EncryptString(Convert.ToString(users.UserId));
            string EncodedURL              = WebUtility.UrlEncode(EncryptedUserId.Replace("+", "œ").Replace("=", "Ž").Replace("/", "ô"));
            string EncriptedAppointmentId  = EncryptionDecryptionHelper.EncryptString(Convert.ToString(users.AppointmentId));
            string EncodedAppointmentIdURL = WebUtility.UrlEncode(EncriptedAppointmentId.Replace("+", "œ").Replace("=", "Ž").Replace("/", "ô"));

            if (!users.IsConsentFormFilled)
            {
                string emailLink1 = $"<a href={ _consentFormUrl + EncodedURL + '/' + EncodedAppointmentIdURL + '/' + users.FMFullName.Replace(" ", "%20") }>click on</a>";
                body2.AppendLine($"Please {emailLink1} to complete your consent form before your appointment date.<br /><br />");
            }

            //body2.AppendLine($"Gentle reminder for Your " + users.ActivityType + "  appointment is scheduled for " + users.startDateInString + "  " + users.StartTime + " with " + users.CounsollerName + ".<br /><br />");
            if (users.ActivityType == "Scheduled Chat")
            {
                string emailLink = $"<a href={ _familychaturl + users.ACEAppointmentId }>click here</a>";
                body2.AppendLine($"Your appointment is booked at " + users.StartTime + " with " + users.CounsollerName + " via AccessChat.<br /><br />");
                body2.AppendLine($"Please note, if your appointment is via Video or AccessChat, you will need to log into our portal {emailLink} to join your session. <br /><br />");
                body2.AppendLine($"If you are unable to attend this appointment, please login to the booking portal  and cancel your appointment.<br /><br />");
            }
            if (users.ActivityType == "Video")
            {
                string emailLink = $"<a href={ _familyvediochaturl + users.ACEAppointmentId }>click here</a>";
                body2.AppendLine($"Your appointment is booked at " + users.StartTime + " with " + users.CounsollerName + " via Video.<br /><br />");
                body2.AppendLine($"Please note, if your appointment is via Video or AccessChat, you will need to log into our portal {emailLink} to join your session. <br /><br />");
                body2.AppendLine($"If you are unable to attend this appointment, please login to the booking portal  and cancel your appointment.<br /><br />");
            }
            if (users.ActivityType == "Telephone")
            {
                body2.AppendLine($"Your appointment is booked at " + users.StartTime + " with " + users.CounsollerName + " via Telephone.<br /><br />");
                body2.AppendLine($"Please note, For Telephone bookings, the Counsellor will call you at the appointment time. We recommend ensuring that your phone is charged and you are in a quiet place where you can speak freely. <br /><br />");
                body2.AppendLine($"If you are unable to attend this appointment, please login to the booking portal  and cancel your appointment.<br /><br />");
            }
            if (users.ActivityType == "Face to Face")
            {
                body2.AppendLine($"Your appointment is booked at " + users.StartTime + " with " + users.CounsollerName + ". The location of your appointment is " + users.Location + ".<br /><br />");
                body2.AppendLine($"If you are unable to attend this appointment, please login to the booking portal and cancel your appointment. As this is less than 24 hours before your appointment, this session will be deducted from your session allowance. We appreciate you letting us know as a courtesy to your counsellor.<br /><br />");
            }


            body2.AppendLine($"{regards}<br />");
            body2.AppendLine($"{footerlink}");

            var apiKey = _config.GetSection("EmailSendGridKey").Value;


            var client = new SendGridClient(apiKey);

            if (!users.IsForFamilyMember)
            {
                var msg = new SendGridMessage()
                {
                    From             = new EmailAddress(_fromEmail, _fromName),
                    Subject          = users.ClientName + ", reminder of your AccessEAP appointment",
                    PlainTextContent = "",
                    HtmlContent      = body.ToString(),
                };
                msg.AddTo(new EmailAddress(users.ClientEmailId));
                var response = await client.SendEmailAsync(msg);
            }
            var msg1 = new SendGridMessage()
            {
                From             = new EmailAddress(_fromEmail, _fromName),
                Subject          = users.CounsollerName + ", reminder of your AccessEAP appointment",
                PlainTextContent = "",
                HtmlContent      = body1.ToString(),
            };

            msg1.AddTo(new EmailAddress(users.CounsollerEmailId));

            if (users.IsForFamilyMember)
            {
                var msg2 = new SendGridMessage()
                {
                    From             = new EmailAddress(_fromEmail, _fromName),
                    Subject          = users.FMFirstName + ", reminder of your AccessEAP appointment",
                    PlainTextContent = "",
                    HtmlContent      = body2.ToString(),
                };
                msg2.AddTo(new EmailAddress(users.FMEmail));
                var response2 = await client.SendEmailAsync(msg2);
            }


            var response1 = await client.SendEmailAsync(msg1);
        }
Example #6
0
        public async Task SendMailAppointmentBooking(CousollerandClientDetail users)
        {
            var body = new StringBuilder();

            //Client//
            body.AppendFormat("Dear  " + users.ClientName + ",<br /><br />");
            body.AppendFormat($"Thank you for booking an appointment with us. This email confirms the details of your counselling session.<br />");
            // body.AppendLine($"Your "+users.ActivityType+"  appointment is scheduled for " + users.startDateInString + "  " + users.StartTime + " with " +users.CounsollerName+".<br /><br />");
            //body.AppendLine("<a href=\'"+ _forgetpasswordurl + HttpUtility.UrlEncode(EncryptedUserId) + "\">Change Password</a>");
            string logiPortal = $"<a href={_loginUrl}>click here</a>";

            if (users.ActivityType == "Scheduled Chat")
            {
                string emailLink = $"<a href={ _chatdUrl + users.ACEAppointmentId }>click here</a>";

                body.AppendLine($"Date: " + users.startDateInString + "<br />");
                body.AppendLine($"Time: " + users.StartTime + "<br />");
                body.AppendLine($"Modality: AccessChat<br />");
                body.AppendLine($"Counsellor: " + users.CounsollerName + "<br />");
                body.AppendLine($"Please note, if your appointment is via Video or AccessChat, you will need to log into our portal here {emailLink} to join your session.<br />If you need to re-schedule or cancel your appointment/s please do so with at least 24 hours’ notice(business days), otherwise your session will count towards your session allowance.Counselling is a very personal experience and the counsellor plays an important role.If you would prefer to talk to a different counsellor, you are welcome to search for someone more suitable to your needs for your next appointment. <br />");
                body.AppendLine($"If you are unable to attend this appointment, please login to the booking portal here {logiPortal} and cancel your appointment.<br /><br />");
            }
            if (users.ActivityType == "Video")
            {
                string emailLink = $"<a href={ _vediochatdUrl + users.ACEAppointmentId }>click here</a>";
                body.AppendLine($"Date: " + users.startDateInString + "<br />");
                body.AppendLine($"Time: " + users.StartTime + "<br />");
                body.AppendLine($"Modality: " + users.ActivityType + "<br />");
                body.AppendLine($"Counsellor: " + users.CounsollerName + "<br />");
                body.AppendLine($"Please note, if your appointment is via Video or AccessChat, you will need to log into our portal here {emailLink} to join your session. <br />If you need to re-schedule or cancel your appointment/s please do so with at least 24 hours’ notice(business days), otherwise your session will count towards your session allowance.Counselling is a very personal experience and the counsellor plays an important role.If you would prefer to talk to a different counsellor, you are welcome to search for someone more suitable to your needs for your next appointment.<br />");
                body.AppendLine($"If you are unable to attend this appointment, please login to the booking portal here {logiPortal} and cancel your appointment.<br /><br />");
            }
            if (users.ActivityType == "Face to Face")
            {
                body.AppendLine($"Date: " + users.startDateInString + "<br />");
                body.AppendLine($"Time: " + users.StartTime + "<br />");
                body.AppendLine($"Location: " + users.Location + "<br />");
                body.AppendLine($"Counsellor: " + users.CounsollerName + "<br />");
                body.AppendLine($"If you need to re-schedule or cancel your appointment/s please do so with at least 24 hours’ notice (business days), otherwise your session will count towards your session allowance. Counselling is a very personal experience and the counsellor plays an important role. If you would prefer to talk to a different counsellor, you are welcome to search for someone more suitable to your needs for your next appointment.<br /><br />");
            }
            if (users.ActivityType == "Telephone")
            {
                body.AppendLine($"Date: " + users.startDateInString + "<br />");
                body.AppendLine($"Time: " + users.StartTime + "<br />");
                body.AppendLine($"Modality: " + users.ActivityType + "<br />");
                body.AppendLine($"Counsellor: " + users.CounsollerName + "<br />");
                body.AppendLine($"Please note, For Telephone bookings, the Counsellor will call you at the appointment time-we recommend ensuring that your phone is charged and you are in a quiet place where you can speak freely.<br />If you need to re-schedule or cancel your appointment/s please do so with at least 24 hours’ notice(business days), otherwise your session will count towards your session allowance.Counselling is a very personal experience and the counsellor plays an important role.If you would prefer to talk to a different counsellor, you are welcome to search for someone more suitable to your needs for your next appointment.<br />");
                body.AppendLine($"If you are unable to attend this appointment, please login to the booking portal here {logiPortal} and cancel your appointment.<br /><br />");
            }
            body.AppendLine($"{regards}<br />");
            body.AppendLine($"{footerlink}");

            var body1 = new StringBuilder();

            body1.AppendFormat("Dear " + users.CounsollerName + ",<br /><br />");
            //body1.AppendFormat($"Thank you for booking an appointment with us. This email confirms the details of your client session.");
            if (users.IsForFamilyMember)
            {
                body1.AppendLine($"Your " + users.ActivityType + "  appointment is scheduled for " + users.startDateInString + "  " + users.StartTime + " with " + users.FMFirstName + ".<br /><br />");
            }
            else
            {
                body1.AppendLine($"Your " + users.ActivityType + "  appointment is scheduled for " + users.startDateInString + "  " + users.StartTime + " with " + users.ClientName + ".<br /><br />");
            }
            if (users.ActivityType == "Scheduled Chat")
            {
                string emailLink = $"<a href={ _chatdConUrl + users.ACEAppointmentId }>click here</a>";
                body1.AppendLine($"Date: " + users.startDateInString + "<br />");
                body1.AppendLine($"Time: " + users.StartTime + "<br />");
                body1.AppendLine($"Modality: AccessChat<br /><br />");
                body1.AppendLine($"Please {emailLink}  to chat.<br /><br />");
            }
            if (users.ActivityType == "Video")
            {
                string emailLink = $"<a href={ _vediochatdConUrl + users.ACEAppointmentId }>click here</a>";
                body1.AppendLine($"Date: " + users.startDateInString + "<br />");
                body1.AppendLine($"Time: " + users.StartTime + "<br />");
                body1.AppendLine($"Modality: " + users.ActivityType + "<br /><br />");
                body1.AppendLine($"Please {emailLink}  to video chat.<br /><br />");
            }
            if (users.ActivityType == "Face to Face")
            {
                body1.AppendLine($"Date: " + users.startDateInString + "<br />");
                body1.AppendLine($"Time: " + users.StartTime + "<br />");
                body1.AppendLine($"Location: " + users.Location + "<br />");
                if (users.IsForFamilyMember)
                {
                    body1.AppendLine($"Client: " + users.FMFirstName + "<br /><br />");
                }
                else
                {
                    body1.AppendLine($"Client: " + users.ClientName + "<br /><br />");
                }
                // body1.AppendLine($"If you need to re-schedule or cancel your appointment/s please do so with at least 24 hours’ notice (business days), otherwise your session will count towards your session allowance. Counselling is a very personal experience and the counsellor plays an important role. If you would prefer to talk to a different counsellor, you are welcome to search for someone more suitable to your needs for your next appointment.<br /><br />");
            }
            //body.AppendLine("<a href=\'"+ _forgetpasswordurl + HttpUtility.UrlEncode(EncryptedUserId) + "\">Change Password</a>");
            body1.AppendLine($"{regards}<br />");
            body1.AppendLine($"{footerlink}");
            var body2 = new StringBuilder();

            if (users.IsForFamilyMember)
            {
                body2.AppendFormat("Dear " + users.FMFirstName + ",<br /><br />");
                body2.AppendLine($"Thank you for booking an appointment with us. This email confirms the details of your counselling session.<br />");
                string EncryptedUserId         = EncryptionDecryptionHelper.EncryptString(Convert.ToString(users.UserId));
                string EncodedURL              = WebUtility.UrlEncode(EncryptedUserId.Replace("+", "œ").Replace("=", "Ž").Replace("/", "ô"));
                string EncriptedAppointmentId  = EncryptionDecryptionHelper.EncryptString(Convert.ToString(users.AppointmentId));
                string EncodedAppointmentIdURL = WebUtility.UrlEncode(EncriptedAppointmentId.Replace("+", "œ").Replace("=", "Ž").Replace("/", "ô"));
                string emailLink1              = $"<a href={ _consentFormUrl + EncodedURL + '/' + EncodedAppointmentIdURL + '/' + users.FMFullName.Replace(" ", "%20")}>click on</a>";

                if (users.ActivityType == "Scheduled Chat")
                {
                    string emailLink = $"<a href={ _familychaturl + users.ACEAppointmentId }>click here</a>";
                    body2.AppendLine($"Date: " + users.startDateInString + "<br />");
                    body2.AppendLine($"Time: " + users.StartTime + "<br />");
                    body2.AppendLine($"Modality: AccessChat<br />");
                    body2.AppendLine($"Counsellor: " + users.CounsollerName + "<br />");
                    body2.AppendLine($"Please {emailLink1} to complete your consent form before your appointment date. <br /> ");
                    body2.AppendLine($"Please note, if your appointment is via Video or AccessChat, you will need to log into our portal here {emailLink} to join your session.<br />If you need to re-schedule or cancel your appointment/s please do so with at least 24 hours’ notice(business days), otherwise your session will count towards your session allowance.Counselling is a very personal experience and the counsellor plays an important role.If you would prefer to talk to a different counsellor, you are welcome to search for someone more suitable to your needs for your next appointment.<br />");
                    body2.AppendLine($"If you are unable to attend this appointment, please login to the booking portal here {logiPortal} and cancel your appointment.<br /><br />");
                }
                if (users.ActivityType == "Video")
                {
                    string emailLink = $"<a href={ _familyvediochaturl + users.ACEAppointmentId }>click here</a>";
                    body2.AppendLine($"Date: " + users.startDateInString + "<br />");
                    body2.AppendLine($"Time: " + users.StartTime + "<br />");
                    body2.AppendLine($"Modality: " + users.ActivityType + "<br />");
                    body2.AppendLine($"Counsellor: " + users.CounsollerName + "<br />");
                    body2.AppendLine($"Please {emailLink1} to complete your consent form before your appointment date.<br />");
                    body2.AppendLine($"Please note, if your appointment is via Video or AccessChat, you will need to log into our portal here  {emailLink} to join your session. <br />If you need to re-schedule or cancel your appointment/s please do so with at least 24 hours’ notice(business days), otherwise your session will count towards your session allowance.Counselling is a very personal experience and the counsellor plays an important role.If you would prefer to talk to a different counsellor, you are welcome to search for someone more suitable to your needs for your next appointment.<br />");
                    body2.AppendLine($"If you are unable to attend this appointment, please login to the booking portal here {logiPortal} and cancel your appointment.<br /><br />");
                }
                if (users.ActivityType == "Face to Face")
                {
                    body2.AppendLine($"Date: " + users.startDateInString + "<br />");
                    body2.AppendLine($"Time: " + users.StartTime + "<br />");
                    body2.AppendLine($"Location: " + users.Location + "<br />");
                    body2.AppendLine($"Counsellor: " + users.CounsollerName + "<br />");
                    body2.AppendLine($"Please {emailLink1} to complete your consent form before your appointment date.<br />");
                    body2.AppendLine($"If you need to re-schedule or cancel your appointment/s please do so with at least 24 hours’ notice (business days), otherwise your session will count towards your session allowance. Counselling is a very personal experience and the counsellor plays an important role. If you would prefer to talk to a different counsellor, you are welcome to search for someone more suitable to your needs for your next appointment.<br /><br />");
                }
                if (users.ActivityType == "Telephone")
                {
                    body2.AppendLine($"Date: " + users.startDateInString + "<br />");
                    body2.AppendLine($"Time: " + users.StartTime + "<br />");
                    body2.AppendLine($"Modality: " + users.ActivityType + "<br />");
                    body2.AppendLine($"Counsellor: " + users.CounsollerName + "<br />");
                    body2.AppendLine($"Please {emailLink1} to complete your consent form before your appointment date.<br />");
                    body2.AppendLine($"Please note, For Telephone bookings, the Counsellor will call you at the appointment time-we recommend ensuring that your phone is charged and you are in a quiet place where you can speak freely.<br />If you need to re-schedule or cancel your appointment/s please do so with at least 24 hours’ notice(business days), otherwise your session will count towards your session allowance.Counselling is a very personal experience and the counsellor plays an important role.If you would prefer to talk to a different counsellor, you are welcome to search for someone more suitable to your needs for your next appointment.<br />");
                    body2.AppendLine($"If you are unable to attend this appointment, please login to the booking portal here {logiPortal} and cancel your appointment.<br /><br />");
                }
                //body2.AppendLine("<a href=\'" + _consentFormUrl + HttpUtility.UrlEncode(EncryptedUserId) +"/"+ HttpUtility.UrlEncode(EncodedAppointmentIdURL) + "\">click here to fill Consent Form.</a>");
                body2.AppendLine($"{regards}<br />");
                body2.AppendLine($"{footerlink}");
            }
            var apiKey = _config.GetSection("EmailSendGridKey").Value;


            var client = new SendGridClient(apiKey);

            if (!users.IsForFamilyMember)
            {
                var msg = new SendGridMessage()
                {
                    From             = new EmailAddress(_fromEmail, _fromName),
                    Subject          = users.ClientName + ", " + "confirmation of your AccessEAP appointment",
                    PlainTextContent = "",
                    HtmlContent      = body.ToString(),
                };
                msg.AddTo(new EmailAddress(users.ClientEmailId));
                var response = await client.SendEmailAsync(msg);
            }
            var msg1 = new SendGridMessage()
            {
                From             = new EmailAddress(_fromEmail, _fromName),
                Subject          = users.CounsollerName + " " + "confirmation of your AccessEAP appointment",
                PlainTextContent = "",
                HtmlContent      = body1.ToString(),
            };

            msg1.AddTo(new EmailAddress(users.CounsollerEmailId));

            if (users.IsForFamilyMember)
            {
                var msg2 = new SendGridMessage()
                {
                    From             = new EmailAddress(_fromEmail, _fromName),
                    Subject          = users.FMFirstName + ", " + "confirmation of your AccessEAP appointment",
                    PlainTextContent = "",
                    HtmlContent      = body2.ToString(),
                };
                msg2.AddTo(new EmailAddress(users.FMEmail));
                var response2 = await client.SendEmailAsync(msg2);
            }


            var response1 = await client.SendEmailAsync(msg1);
        }