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

  • SEARCH
  • Home
  • 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 6660091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:06:42+00:00 2026-05-26T02:06:42+00:00

I am writing a mvc 3 application and part of its function is to

  • 0

I am writing a mvc 3 application and part of its function is to send out confirmation emails along with an assortment of other emails.. I have the body’s for the different types of emails stored in a database table.. Getting the values out of the table and dropping them in a email body using System.Net.Mail isnt a problem at all… What I need to do is somehow put somekind of variable marker in the body which is in the database table and then somehow parse the body text when its dropped into the email body to find the variable marker and put the correct value in it’s spot… Any Ideas??? Code snippet of what I have so far is below:

Keep in mind that this will be a rather large body and there are a few places values will have to be dropped in.. I was thinking of having it use something like this:

Long mail body ^^Name^^ has been approved for classes starting on ^^Date^^ at the ^^Place^^ located in ^^Location^^..

When the code loades the text from the body when ever it comes across a variable marked with ^^ it would put the correct information in its place…

            Dim _content As email = db.emails.Where(Function(f) f.ref_name = "Confirmation")
            Dim _body As String = _content.email_body.ToString
            Dim SmtpServer As New SmtpClient()
            Dim mail As New MailMessage()
            mail.Subject = "Testing Confirmation"
            mail.To.Add("developer@myemail.com")
            mail.From = New MailAddress("myemail@myemail.com")
            mail.Body = _body
  • 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-26T02:06:43+00:00Added an answer on May 26, 2026 at 2:06 am

    Why not do exactly what you just described. In your database your email template would be something like:

    Dear [[Name]],
    
    This is just a sample message.
    

    Then you would create a class to do the replacing:

    Class EmailTemplateReplacer
       Public Function DoTheReplace(ByVal emailTemplate as String) as String
           return emailTemplate.Replace("[[Name]]", "whatever you want here")
       EndFunction
    EndClass
    

    Then just call it in your code:

    Dim _content As email = db.emails.Where(Function(f) f.ref_name = "Confirmation")
    Dim _body As String = _content.email_body.ToString
    
    Dim replacer as New EmailTemplateReplacer()
    _body = replacer.DoTheReplace(_body)
    
    Dim SmtpServer As New SmtpClient()
    Dim mail As New MailMessage()
    mail.Subject = "Testing Confirmation"
    mail.To.Add("developer@myemail.com")
    mail.From = New MailAddress("myemail@myemail.com")
    mail.Body = _body
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing my SPring MVC web application. I have set my session time out
I am writing a web application on Asp.Net MVC 3. Assume that we have
I'm writing my first asp.net mvc application and I have a question about custom
I'm writing a WinForms application and want to have an MVC-Type Design. Actually it's
I have mvc application and I'm working with poco objects and writing unit test.
I am writing an ASP.NET MVC 3 application and I have a number of
An ASP.Net MVC 3 application I've just started writing needs to have authentication for
I'm writing an ASP.NET MVC application and I have a form where a user
I am writing an ASP.Net MVC application. I have two entities - patients and
I'm writing an ASP.NET MVC application and trying to use a RESX file to

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.