Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using MvcMailer with a service layer? #7

Closed
chobo2 opened this issue Mar 27, 2011 · 5 comments
Closed

Using MvcMailer with a service layer? #7

chobo2 opened this issue Mar 27, 2011 · 5 comments

Comments

@chobo2
Copy link

chobo2 commented Mar 27, 2011

Hi

I am very interested in using your library as I think it is cool that I could use views to make good looking emails.

I however don't know how to use it with a service layer. I currently have 2 projects one with my mvc 3 code and one for my repos and service layers.

Right now I need to do this. Controller extracts ViewModel data and passes it to service layer. Service layer does some business logic and depending on what options where chosen sends a email.

I want to send the email but use MvcMailer. However that probably would mean I need to add a reference to MVC in my service layer project. I do not want to do this as I think the service layer and repos should know nothing about MVC. I do this with my VM and use automapper and map them to a domain object and send it to the service layers as I don't want to have selectLists or MVC depended code coming along.

How could I use MvcMailer and still respect the boundaries of the service layer?

Thanks

@smsohan
Copy link
Owner

smsohan commented Mar 28, 2011

Interesting point. I will see if I can help you about this. First
thing comes to my mind is, you can push your Mailer classes in the
service layer while putting the views in mvc project. But the service
layer will need to reference MVC for this to work. I think it's not
too bad to add a reference to MVC - if you want to use it's features,
such as, view templates. But I will try to figure out if there's a
better way!
Thanks for writing.


Sent from my iPhone

On 2011-03-27, at 5:24 PM, chobo2
reply@reply.github.com
wrote:

Hi

I am very interested in using your library as I think it is cool that I could use views to make good looking emails.

I however don't know how to use it with a service layer. I currently have 2 projects one with my mvc 3 code and one for my repos and service layers.

Right now I need to do this. Controller extracts ViewModel data and passes it to service layer. Service layer does some business logic and depending on what options where chosen sends a email.

I want to send the email but use MvcMailer. However that probably would mean I need to add a reference to MVC in my service layer project. I do not want to do this as I think the service layer and repos should know nothing about MVC. I do this with my VM and use automapper and map them to a domain object and send it to the service layers as I don't want to have selectLists or MVC depended code coming along.

How could I use MvcMailer and still respect the boundaries of the service layer?

Thanks

Reply to this email directly or view it on GitHub:
#7

@smsohan smsohan closed this as completed Jun 30, 2011
@justSteve
Copy link

I'm migrating to MVCMailer with a mail-intensive project - would love to see if anything has come from this exploration. thx!

@smsohan
Copy link
Owner

smsohan commented Nov 15, 2011

I wish I could fix this the way I wanted to. But looks like the best bet
is, you put the view related code in your MVC layer, possibly extracting
out all your business logic in the business layer as you would do for your
controllers. The view lookup and web.config modifications are too tightly
coupled with the MVC implementation and its simply not possible to extract
out the code into a separate business layer as of now.

And if you need to hit it on a scheduled task, expose a WCF endpoint for
your mailer and you'll be be able to hit it from a background process. This
way, you will have access to httpContext and all the http classes that you
need for MVC to work.

Sohan
http://smsohan.com
skype:smsohan | gtalk:sohan39 | cell: 403-714-2673

On Tue, Nov 15, 2011 at 12:00 PM, justSteve <
reply@reply.github.com

wrote:

I'm migrating to MVCMailer with a mail-intensive project - would love to
see if anything has come from this exploration. thx!


Reply to this email directly or view it on GitHub:
#7 (comment)

@tafs7
Copy link

tafs7 commented Jan 15, 2013

Could you do something like use the RazorEngine project (on github also), to udpate the way MvcMailer does templating?

@smsohan
Copy link
Owner

smsohan commented Jan 15, 2013

I was thinking about it. It would make mailing independent of ASP.Net MVC
and can be used in a console app or from a class library. Let me know if
you'd want to take a lead on this.

Sohan
http://smsohan.com
skype:smsohan | gtalk:sohan39 | cell: 403-714-2673

On Tue, Jan 15, 2013 at 3:02 PM, tafs7 notifications@github.com wrote:

Could you do something like use the RazorEngine project (on github also),
to udpate the way MvcMailer does templating?


Reply to this email directly or view it on GitHubhttps://github.com//issues/7#issuecomment-12291921.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants