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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:13:56+00:00 2026-06-08T16:13:56+00:00

I am using MvcMailer and trying to pass calculated values. These values are calculated

  • 0

I am using MvcMailer and trying to pass calculated values. These values are calculated after the user inputs information into a wizard form (textbox, radio button list, etc.). Sorry if this is lengthy, but I want to give as much context as possible to avoid “show me more code” comments. I am using a View Model (QuoteData). My “prices” are kept in a model (PriceQuote).

Here is an example calculation (and the attendant “total” code) in my Calculation.cs:

public decimal decOne(QuoteData quoteData)
{
    if (quoteData.Step.RadioButtonOne == Step.EnumOne.ChoiceOne)
            return PriceQuote.priceOne;
    else
        return 0;
}
....
public decimal TotalOne(QuoteData quoteData)
{
    decimal totalOne = PriceQuote.priceBase;
    total += this.decOne(quoteData);
    ....
    return total;
}

My View Model is like this (not sure if this is correct, or if this is where I should do some calculations):

public class QuoteData
{
    public Calculations Calculations { get; set; }
    ....
}
public QuoteData()
{
Calculations = new Caluclations();
}

What I previously did for mock-up purposes was put this in an action in a mock controller:

Calculations calc = new Calculations();

var totalone = calc.TotalOne(quoteData);
ViewBag.CalculateTotalOne = totalone;

return View(quoteData);

And I called it thusly in the page:

@((ViewBag.CalculationTotalOne).ToString("C2"))

Again, this was for mock purposes. Now, with MvcMailer I cannot do the same thing, and have struggled all weekend to figure out how to get it to work. Everything I’ve researched and tried did not work. I’m sure it’s something simple that I have overlooked.

MvcMailer’s view doesn’t use a controller. It uses a class (QuoteMailer in my case). Here is how my Wizard passes to MvcMailer:

public ActionResult Submitted()
{
    QuoteMailer.EMailQuote(quoteData).Send();
    return View(quoteData);
}

Here is EMailQuote in QuoteMailer:

public virtual MailMessage EMailQuote(QuoteData model)
    {
        var mailMessage = new MailMessage { Subject = "..." };

        mailMessage.To.Add(model.Step.EMail);
        mailMessage.To.Add("web@site.com");

        ViewData = new ViewDataDictionary(model);
        PopulateBody(mailMessage, viewName: "EMailQuote");

        return mailMessage;
    }

Any help is appreciated (how do I pass my calculations here, whereas in the mock scenario I used ViewBag?)

  • 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-08T16:13:59+00:00Added an answer on June 8, 2026 at 4:13 pm

    MVCMailer Mailers extend ControllerBase so at the end of the day they work exactly like a controller. You should be able to send your data to your Mailer view the same way(s) you would in a regular controller. Here is a link that describes all the ways that you can send data to your Mailer View. In your case you may be able to do the following to use your strongly typed model as long as the View expects of Model of type QuoteData:

    public virtual MailMessage EMailQuote(QuoteData model)
    {
        var mailMessage = new MailMessage { Subject = "..." };
    
        mailMessage.To.Add(model.Step.EMail);
        mailMessage.To.Add("web@site.com");
    
        ViewData.Model = model;
        PopulateBody(mailMessage, viewName: "EMailQuote");
    
        return mailMessage;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to send the contents of a form with MvcMailer in my
Using IOS, I am trying to integrate the LinkedIn into the application. The integration
Using linq2sql I'm trying to take the string in txtOilChange and update the oilChange
Using the navigator.geolocation object in JavaScript. Trying to establish accurate ranges, but wondering exactly
Using Rails 3.2.0 with haml, sass and coffeescript: Basically I am trying to disable
I am using MvcMailer with Orchard CMS in a module I created, and although
I'm using the excellent MvcMailer package to send email from within my application. I'm
Using mercurial, I've run into an odd problem where a line from one committer
Using MVC2 I have an AJAX form which is posting to a bound model.
Using Java,I have to fetch multiple sets of values from an XML 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.