如何使用MVCMailer没有打破我的服务层? [英] How to use MVCMailer without breaking my service layer?

查看:132
本文介绍了如何使用MVCMailer没有打破我的服务层?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我期待到使用 MVcMailer 做出更好的电子邮件。

I am looking into using MVcMailer to make nicer emails.

不过有一件事我不能确定是如何组织code。我现在有2个项目。一为MVC,一个是我的回购协议和服务层。

However one thing that I am unsure is how to organize the code. I currently have 2 projects. One for mvc and one for my repos and service layers.

我的第二个项目没有MVC的知识,我想保持这种方式。

my 2nd project has no knowledge of MVC and I would like to keep it that way.

我在想,我的SMTP code将进入一个服务层或包装,然后我就从其他服务层,当我需要发送电子邮件进行调用它。

I am thinking that my smtp code would go into a service layer or wrapper and then I would call it up from other service layers when I need to send emails out.

那么,这是否对MVC邮件适合吗?我生成在控制器主体然后将它传递给它传递到我的SMTP类serivce层

So where does the MVC mailer fit in? Do I generate the body in the controller then pass it to a serivce layer that passes it to my smtp class?

推荐答案

MVCMailer似乎已经有发送电子邮件的支持。如果您设置的配置正确,应该能够通过电子邮件发送填充MailerViews无需额外的实现。

MVCMailer seems to already have support for sending email. If you setup the config correctly it should be able to email the populated MailerViews without additional implementation.

我不知道你的第二个项目在你的解决方案中的作用,但这里有两种可能性:

I am not sure of the role of your second project in you solution but here are two possibilities:


  1. 也许不实用...等等
    与该版的电子邮件发送
    从后台进程

  1. Probably not practical ... Wait for the version with "Email Sending from a Background Process"

从你的第二个项目忘记有关SMTP
和使用HTTP只是调用视图
这反过来会调用MVCMailer

Forget about Smtp from your second project and using Http just call a View which in turn would call MVCMailer

这篇关于如何使用MVCMailer没有打破我的服务层?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆