消息中没有正文(MvcMailer + Orchard CMS)
我在我创建的模块中使用 MvcMailer 和 Orchard CMS,虽然我可以用它来发送电子邮件,但电子邮件正文是空的,让我相信 Orchard 没有接收“/[Module] /Views/[NameOfMailerFolder/_Layout.cshtml”或“.../[NameofMailerView].cshtml”。
起初我认为将“/[Module]/Views/[NameOfMailerFolder]”移动到“/[ThemeBeingUsed]/Views”文件夹或 Orchard.Web 的“/Views”文件夹可能会起作用(我认为这只是没有找到路径)。但没有运气。
我尝试在模块中使用route.cs,但我不知道是否可以将 CONTROLLER 和 ACTION 留空(“”)并将“/[Module]/Views/[NameOfMailerFolder]”放在那里仅有的。无论如何,我为“[NameOfMailerView].cshtml”创建了一条路线,但这也不起作用。我想知道这是否是正确的方法(我没有在控制器中设置操作,但我正在考虑这样做 - 只需要重定向?)。
我有点迷失了,所以我很感谢任何指导。
I am using MvcMailer with Orchard CMS in a module I created, and although I can get it to send e-mails, the body of the e-mail is empty, leaving me to believe that Orchard is not picking up "/[Module]/Views/[NameOfMailerFolder/_Layout.cshtml" or ".../[NameofMailerView].cshtml".
At first I thought that moving "/[Module]/Views/[NameOfMailerFolder]" either to the "/[ThemeBeingUsed]/Views" folder or to the "/Views" folder of Orchard.Web might work (I thought it was just not finding the paths). But no luck.
I tried playing around with route.cs in my module, but I don't know whether or not I can just leave CONTROLLER and ACTION empty ("") and put the "/[Module]/Views/[NameOfMailerFolder]" in there only. In any event, I created a route for "[NameOfMailerView].cshtml" but that hasn't worked either. I am wondering if this is even the right way to go (I did not set up actions in a controller, but am thinking to do so - just going to have to redirect?).
I'm a bit lost, so I appreciate any guidance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,Mailer 代码使用了 MasterName,这似乎是导致 Orchard CMS 的处理方式出现问题的原因。
这就是让它为我工作的原因(使用 1.3 或 Orchard.Web):
QuoteMailers 只是我的名字,如果您在 VS 中使用 Package Manger Console,MvcMailer 将根据您使用的参数创建一个名称。
注释掉 MasterName 才是有效的!这个“hack”的唯一缺点是我不使用通用的 _Layout 文件。对我来说这没什么大不了的,因为我能够使用 Partials。
It turns out that the Mailer code uses a MasterName, which is what appears to cause problems with Orchard CMS's way of doing things.
This is what gets it working for me (using 1.3 or Orchard.Web):
QuoteMailers is just my name, MvcMailer will create a name based on the parameters you use if you are using the Package Manger Console in VS.
Commenting out MasterName is what works! The only drawback to this "hack" is that I don't use a common _Layout file. To me that's no big deal because I am AM able to use Partials.