public async Task SendChangedPasswordAsync(User user)
        {
            string subject = "Password changed";
            string content = changedPasswordTemplate;

            Guid   emailId = Guid.NewGuid();
            string header  = emailHeader;

            EmailTools.FormatHeader(ref header, emailId, subject, user);
            EmailTools.DoReplace(ref header, "[[Title]]", subject);
            string footer = emailFooter;

            string body = header + content + footer;

            await EmailSender.SendEmailAsync(user.Email, GlobalSettings.AdminEmail, fromName, subject, body, true).ContinueWithLogErrors();
        }
        public Emailer(IEmailSender emailSender, string template)
        {
            EmailSender = emailSender;

            emailHeader = template.GetFragment(null, "<!-- START:Changes -->");
            emailFooter = template.GetFragment("<!-- END:Changes -->", null);

            signedupTemplate        = template.GetFragment("<!-- START:Signup -->", "<!-- END:Signup -->");
            changedPasswordTemplate = template.GetFragment("<!-- START:ChangedPassword -->", "<!-- END:ChangedPassword -->");
            purchaseTemplate        = template.GetFragment("<!-- START:Purchase -->", "<!-- END:Purchase -->");

            EmailTools.ReplaceTags(ref emailHeader);
            EmailTools.ReplaceTags(ref emailFooter);
            EmailTools.ReplaceTags(ref signedupTemplate);
            EmailTools.ReplaceTags(ref changedPasswordTemplate);
            EmailTools.ReplaceTags(ref purchaseTemplate);
        }
        public async Task SendFramedEmailAsync(User user, string subject, string content, bool isHtml)
        {
            if (!isHtml)
            {
                content = WebUtility.HtmlEncode(content);
            }

            Guid emailId = Guid.NewGuid();

            string header = emailHeader;

            EmailTools.FormatHeader(ref header, emailId, subject, user);
            EmailTools.DoReplace(ref header, "[[Title]]", subject);
            string footer = emailFooter;

            string body = header + content + footer;

            await EmailSender.SendEmailAsync(user.Email, GlobalSettings.AdminEmail, fromName, subject, body, true).ContinueWithLogErrors();
        }