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 8776385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:02:27+00:00 2026-06-13T19:02:27+00:00

Possible Duplicate: Razor views as email templates I am sending out an email to

  • 0

Possible Duplicate:
Razor views as email templates

I am sending out an email to the user from within my service of my website.

I want to format this so that it shows nice and a specific way.

Here is what I have:

<table bgcolor="#FFE680" border="0" cellpadding="0" cellspacing="0" width="100%">
  <tbody>
    <tr>
      <td width="100%" height="51" valign="middle"><h1> <strong>[COMPANY] User ID Reminder </strong></h1></td>
      <td align="right" valign="top" width="8"><img alt="" width="8" height="8" align="top" /></td>
    </tr>

  </tbody>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tbody>
    <tr>
      <td><table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tbody>
          <tr>
            <td align="left" valign="top" width="100%"><table border="0" cellpadding="0" cellspacing="0" width="100%">
              <tbody>
                <tr>
                  <td><table border="0" cellpadding="0" cellspacing="0" width="100%">
                    <tbody>
                      <tr>
                        <td colspan="1" align="left"></td>
                        </tr>
                      <tr>
                        <td align="left" valign="top" width="100%"><p> <br />
                          Dear [USERNAME], </p>
                          <p> In response to your request to be reminded of your User ID, please   find below the information we have on file for you. If you didn't   submit  this request, ignore this email. </p>
                          <table border="0" cellpadding="0" cellspacing="0">
                            <tbody>
                                  <tr>
                                    <td>Your User ID is: </td>
                                    <td>[USERNAME]</td>
                                    </tr>
                                  <tr>
                                    <td>Your registered email address is:  </td>
                                    <td>[EMAIL]</td>
                                  </tr>
                              </tbody>
                            </table>
                          <p> 
                            If you have forgotten your password, you can request it here.<br />
                          </p>
                          <p> 
                            Thank you,<br />[COMPANY]
                          </p></td>
                        </tr>
                      </tbody>
                    </table></td>
                  </tr>
                </tbody>
              </table></td>
          </tr>
          </tbody>
      </table></td>
    </tr>
  </tbody>
</table>

Now my question isn’t about the looks of the email but how do I put this as the body of my email while populating the appropriate fields?

I put it in resources as a string and I figured I’d just do a replace of the specific [fields]. This starting becoming tedious and seemed sloppy:

var body = SuburbanHUB.Properties.Resources.ForgotPasswordEmailBody.Replace("[USERNAME]", username).Replace("[EMAIL]")...

I’m sure there is a better way of doing this but I have not the experience.

=== CLARIFICATION ===

I am using razor to call a WCF service written in C#. The service that is being called is where the email is being sent from and not the view. I am using Razor with MVC with C# as the underlying code.

  • 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-06-13T19:02:28+00:00Added an answer on June 13, 2026 at 7:02 pm

    I’m in the middle of trying to do the same thing. We’re using Razor templates to generate the email, and passing in a Model which has all the various variables to fill it out. This lets us include everything that Razor and MVC support, including @if and @Html.Partial, which lets us construct an email from pieces.

    The answer we just went with involves running an internal MVC webserver, requesting pages from it with the Model as a parameter, and capturing the response text, but there’s variants on my question that are more self contained. Take a look and see if any of the other answers or comments help you.

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

Sidebar

Related Questions

Possible Duplicate: can’t add data to jqGrid from php within json format I am
Possible Duplicate: Find out the instance id from within an ec2 machine I am
Possible Duplicate: Is it possible to use Razor View Engine outside asp.net I want
Possible Duplicate: using razor within javascript I would like to place a siimple value
Possible Duplicate: How do you send email from a Java app using Gmail? How
Possible Duplicate: How do you access application variables in asp.net mvc 3 razor views?
Possible Duplicate: Escape @ character in razor view engine how can i use '@'
Possible Duplicate: How can I convert a list<> to a multi-dimensional array? I want
Possible Duplicate: How to do the vector of sets in C++? I want to
Possible Duplicate: check whether internet connection is available with C# I just want 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.