在Postal.MVC中找不到“模型”的电子邮件视图

时间:2018-11-01 16:42:04

标签: asp.net-mvc email asp.net-mvc-5 postal

我在ASP MVC5项目中使用Postal.MVC5。最初,我在web.config中配置了smtp配置,因此这段代码可以正常工作,并且能够成功发送电子邮件。

rule multiqc_global:
"""
Aggregate all MultiQC reports
"""
  input:
    expand("intermediate/{smp}_fastqc.zip", smp=SAMPLES),
    expand("intermediate/merged_{smp}_fastqc.zip", smp=SAMPLES),
    expand("logs/star/{smp}_Log.final.out", smp=SAMPLES),
    expand("intermediate/{smp}.geneBodyCoverage.txt", smp=SAMPLES),
    expand("intermediate/{smp}.geneBodyCoverage.r", smp=SAMPLES),
    expand("intermediate/{smp}.junctionSaturation_plot.r", smp=SAMPLES),
  output:
    html = "results/global_multiqc.html",
    stats = "intermediate/global_multiqc_general_stats.txt"
  log:
    "logs/multiqc/global_multiqc.log"
  version: "1.0"
  shadow: "minimal"
  shell: 
    """
    # Run multiQC and keep the html report
    multiqc -n multiqc.html {input} 2> {log}
    mv multiqc.html {output.html}
    mv multiqc_data/multiqc_general_stats.txt {output.stats}
    """

现在,我需要在运行时设置Smtpclient,并按照此stackoverflow帖子中显示的步骤进行操作:How to Set SMTP Client in POSTAL MVC not in WEB.Config

public async Task<ActionResult>SendEmail(EmployeeViewModel emailModel)
{
  string _errorMessage;

  emailModel.To = "john@outlook.com";
  emailModel.Subject = "Test Subject";
  emailModel.Message = "Test Message";

  await emailModel.SendAsync();

  return Json(new {ErrorMessage = _errorMessage});
}

现在,此代码引发如下错误:      System.Exception:找不到EmployeeEmailViewModel的电子邮件视图。搜索的位置:       在Postal.EmailViewRenderer.CreateView(String viewName,ControllerContext controllerContext)处       在Postal.EmailViewRenderer.Render(电子邮件,字符串viewName)

我在〜/ Views / Emails / EmployeeEmailViewModel.cshtml中确实有'EmployeeEmailViewModel'视图。

有人知道为什么我会收到此错误消息或如何解决它吗? 谢谢 桑耶夫

0 个答案:

没有答案