Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7055457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:45:04+00:00 2026-05-28T03:45:04+00:00

I am building an application which will send out custom emails to end users.

  • 0

I am building an application which will send out custom emails to end users.

I have constructed an HTML template from which the emails will be built.

I currently have the template filled with tags as placeholders for the custom content…

|Text-Placeholder|

I have been returning the html file as a string to my CreateEMail Method:

string html = System.IO.File.ReadAllText(Server.MapPath("~/EmailTemplates/emailTemplate.html"));

And then using String.Replace to substitute in the custom text/content

html = html.Replace("|Name-Placeholder|", username);

I am curious if there is a method which would allow me to construct the template as a RazorView strongly typed as a ViewModel which will model the custom text/content, and return the view as an HTML file or directly as a string to pass into the body property of my SMTPClient instance for sending to the user?

Has anyone accomplished something like this or similar?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:45:05+00:00Added an answer on May 28, 2026 at 3:45 am

    Have a look at these libraries:

    There is ActionMailer. Inspired by Ruby’s ActionMailer.

    ActionMailer.Net aims to be an easy, and relatively painless way to send email from your ASP.NET MVC application. The concept is pretty simple. We render HTML by utilizing some pretty snazzy view engines, so why can’t we do the same thing for email?

    http://nuget.org/packages/ActionMailer

    Supports many view engines I think, Razor included of course. And allows you to pass a model into the view. See:
    https://bitbucket.org/swaj/actionmailer.net/wiki/Home

    The code :

    public class MailController : MailerBase
    {
        public EmailResult VerificationEmail(User model)
        {
            To.Add(model.EmailAddress);
            From = "no-reply@mycoolsite.com";
            Subject = "Welcome to My Cool Site!";
            return Email("VerificationEmail", model);
        }
    }
    

    The view:

    @using ActionMailer.Net
    @model User
    @{
        Layout = null;
    }
    Welcome to My Cool Site, @Model.FirstName. We need you to verify your email.
    Click this nifty link to get verified!
    

    There is also another library:

    MvcMailer lets you use your MVC Views to produce stunning emails

    http://nuget.org/packages/MvcMailer
    https://github.com/smsohan/MvcMailer

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building an application which will send status requests to users (via email
I'm building a Java application which will download a HTML page from a website
We're building a Silverlight application which will be offered as SaaS. The end product
I'm looking at building a Rails application which will have some pretty large tables
I'm building an application which will have dynamic allocated objects of type A each
I'm building an Android mobile application using HTML, CSS and JavaScript (jQuery) which will
I am building a simple bookmarking application where users will have extensions installed in
I am building a web application which will generate XML from a database based
I'm building a .NET MVC application which will be deployed on a Windows 2003
We are building an enterprise application in which we will incorporate multiple platforms for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.