Ejemplo n.º 1
0
        /// <summary>
        /// Sends an HTML email with images parsed out and attached as MIME-attachments
        /// </summary>
        /// <param name="to"></param>
        /// <param name="subject"></param>
        /// <param name="html"></param>
        /// <returns></returns>
        public async Task <MailResult> SendHtmlAsync(string to, string subject, string html, string appRoot)
        {
            var helper      = new HtmlMailHelper();
            var parseResult = helper.ParseImages(appRoot, html);

            return(await SendAsync(to, subject, parseResult.Html, true, parseResult.Attachments));
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="TViewModel"></typeparam>
        /// <param name="to"></param>
        /// <param name="subject"></param>
        /// <param name="razorPath">A system path like @"Areas\Home\Views\RazorEngine\Invite.cshtml"</param>
        /// <param name="viewModel"></param>
        /// <returns></returns>
        public async Task <MailResult> SendRazorAsync <TViewModel>(string to, string subject, string razorPath, TViewModel viewModel)
        {
            var    razor = RazorHelper.O;
            string html  = razor.Render(razorPath, viewModel);

            string appRoot     = razor.AppRoot;
            var    helper      = new HtmlMailHelper();
            var    parseResult = helper.ParseImages(appRoot, html);

            html = parseResult.Html;

            return(await SendAsync(to, subject, html, true, parseResult.Attachments));
        }