我尝试发送电子邮件时收到的错误是:
NoViewsFoundException
您必须提供此电子邮件的视图。视图应命名为 ~/Views/Email/VerificationEmail.html.vbhtml.txt.cshtml 或 ~/Views/Email/VerificationEmail.html.vbhtml.html.cshtml(或 WebFormsViewEngine 的 aspx),具体取决于您希望呈现的格式。
在线错误:
Return Email("~/Views/Email/VerificationEmail.html.vbhtml", model)
电子邮件不能以 .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 = "me@my.org"
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!