我得到的錯誤,當我嘗試發送電子郵件:在VB傳送電子郵件與ActionMailer.Mvc,找不到查看
Return Email("~/Views/Email/VerificationEmail.html.vbhtml", model)
可以:
NoViewsFoundException
You must provide a view for this email. Views should be named ~/Views/Email/VerificationEmail.html.vbhtml.txt.cshtml or ~/Views/Email/VerificationEmail.html.vbhtml.html.cshtml (or aspx for WebFormsViewEngine) depending on the format you wish to render.
上線錯誤電子郵件不會以.vbhtml發送,它們必須以.cshtml發送嗎?這對VB如何工作?
這裏是我的代碼控制器:
Imports ActionMailer.Net.Mvc
Public Class EmailController
Inherits MailerBase
Public Function VerificationEmail(ByVal model As RegisterModel) As EmailResult
[To].Add(model.Email)
From = "[email protected]"
Subject = "Thanks for registering with us!"
Return Email("~/Views/Email/VerificationEmail.html.vbhtml", model)
End Function
End Class
這是我的觀點:
@modelType MyBlog.RegisterModel
@Code
Layout = Nothing
End code
Welcome to My Cool Site, @Model.UserName
We need you to verify your email. Click this nifty link to get verified!
@Html.ActionLink("Verify", "Account", New With {.code = Model.Email})
Thanks!
我改變你的代碼,但我仍然得到錯誤:'你必須提供此電子郵件的視圖。根據您想要渲染的格式,視圖應該被命名爲〜/ Views/Email/VerificationEmail.txt.cshtml或〜/ Views/Email/VerificationEmail.html.cshtml(或aspx for WebFormsViewEngine)。 – user1477388
您可以幫忙嗎?我必須刪除並重新發布更多信息嗎?謝謝。 – user1477388
@ user1477388我已經設法重製你的問題,在ActionMailer中肯定有錯誤...沒有必要刪除你的問題,這很好。如果我找到了某些東西,我會更新我的答案。 – nemesv