コード例 #1
0
ファイル: RazorMailMessage.cs プロジェクト: wduffy/RazorMail
        protected IEnumerable<AlternateView> CreateAlternateViews(IParser parser)
        {
            var views = new List<AlternateView>();

            // Get the rendered template and base all its relative urls
            var body = parser.BaseUrls(RenderTemplates());

            // Create the plain text view (base64)
            var plainTextView = AlternateView.CreateAlternateViewFromString(PlainText ?? parser.StripHtml(body), Encoding, "text/plain");
            plainTextView.TransferEncoding = System.Net.Mime.TransferEncoding.QuotedPrintable;
            views.Add(plainTextView);

            // Create the html view (base64)
            var htmlView = AlternateView.CreateAlternateViewFromString(body, Encoding, "text/html");
            htmlView.TransferEncoding = System.Net.Mime.TransferEncoding.QuotedPrintable;
            views.Add(htmlView);

            // Return the alternate views
            return views;
        }