示例#1
0
        /// <summary>
        /// Adds template to email from embedded resource
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="path">Path the the embedded resource eg [YourAssembly].[YourResourceFolder].[YourFilename.txt]</param>
        /// <param name="model">Model for the template</param>
        /// <param name="assembly">The assembly your resource is in. Defaults to calling assembly.</param>
        /// <returns></returns>
        public IFluentEmail PlaintextAlternativeUsingTemplateFromEmbedded <T>(string path, T model, Assembly assembly)
        {
            var template = EmbeddedResourceHelper.GetResourceAsString(assembly, path);
            var result   = Renderer.Parse(template, model, false);

            Data.PlaintextAlternativeBody = result;

            return(this);
        }
示例#2
0
        /// <summary>
        /// Adds template to email from embedded resource
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="path">Path the the embedded resource eg [YourAssembly].[YourResourceFolder].[YourFilename.txt]</param>
        /// <param name="model">Model for the template</param>
        /// <param name="assembly">The assembly your resource is in. Defaults to calling assembly.</param>
        /// <param name="isHtml">True if Body is HTML (default), false for plain text</param>
        /// <returns></returns>
        public IFluentEmail UsingTemplateFromEmbedded <T>(string path, T model, Assembly assembly, bool isHtml = true)
        {
            var template = EmbeddedResourceHelper.GetResourceAsString(assembly, path);
            var result   = Renderer.Parse(template, model, isHtml);

            Data.IsHtml = isHtml;
            Data.Body   = result;

            return(this);
        }