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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:53:36+00:00 2026-05-11T21:53:36+00:00

I am integrating a mailing list into an existing CMS in asp.net MVC. I

  • 0

I am integrating a mailing list into an existing CMS in asp.net MVC.

I need to send a confirmation email to the subscriber. Where should I send it from, the controller, Or the service layer?

Clarification: I would definitely create a separate service method called SendConfirmationEmail(). The question is who calls it the controller handling the registration form or the service that added the pending request to the DB?

Obviously I can send it from both but which is proper MVC?

  • 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-11T21:53:37+00:00Added an answer on May 11, 2026 at 9:53 pm

    I guess the standard approach is to have an email service that is injected into your controller and the controller only invokes the service operation like _emailService.Enqueue(myMessage).

    public class MyController
    {
        IEmailService _emailService;
    
        public MyController(IEmailService emailService)
        {
            _emailService = emailService;
        }
    
        public ActionResult Email()
        {
            var myMessage = new MyMessage();
    
            // Initialize message here
    
            _emailService.Enqueue(myMessage);
            return View();
        }
    }
    

    Some of the benefits are:

    • reuse : if you need to use the
      email functionality in another
      controller / action
    • testability : you can mock the email service in
      unit tests so your tests don’t rely
      on an SMTP server
    • you can substitute mailing implementation and instead of sending mail directly queue it for async sending
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm integrating a 3rd party jquery plugin into a page on my ASP.NET MVC
I was thinking about integrating some instant messaging function into an existing ASP.NET web
I'm looking at integrating a wizard in an existing Spring 3 MVC+JPA+Jquery+JSP application. I
I am looking at integrating asp.net web api in to my web application as
Integrating SimpleModal with ASP.NET I want to thank Eric for producing SimpleModal and compliment
Integrating SimpleModal with ASP.NET and MasterPages This is a continuation of a previous thread
How are you integrating Active Directory objects (users, groups, etc) into your DDD .NET
I am integrating Klazuka Kal into my iPhone app and need more space to
I am integrating the MailChimp API into my app and am using a UserObserver
I am integrating a WordPress template. But my category list is repeating again. This

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.