Elmah没有发送电子邮件 [英] Elmah not sending Email

查看:87
本文介绍了Elmah没有发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Mvc4应用程序中实现了Elmah.我的web.config如下:-

I have implemented Elmah in my Mvc4 application.My web.config is as follows:-

<configuration>
  <configSections>
      <sectionGroup name="elmah">
          <section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
          <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
          <section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />
          <section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" />
      </sectionGroup>        
  </configSections>

    <elmah>
        <security allowRemoteAccess="1" />
        <errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data"/>
        <errorMail from="test@test.in" to="test1@test.in" subject="Elmah Report" async="true" smtpServer="mail.test.in" />            
    </elmah>

  <connectionStrings>
    <add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=aspnet-Mvcjquery-20130225111502;Integrated Security=SSPI" />
  </connectionStrings>   

    <system.web>
      <httpHandlers>
          <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />         
      </httpHandlers>

      <httpModules>
          <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
          <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah"/>

     </httpModules>        
  </system.web>

  <system.webServer>
      <validation validateIntegratedModeConfiguration="false"/>
      <modules>
          <add name="Elmah.ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
          <add name="Elmah.ErrorMail" type="Elmah.ErrorMailModule" preCondition="managedHandler" />
      </modules>

      <handlers>
          <add name="Elmah" path="elmah.axd" verb="POST,GET,HEAD" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />         
      </handlers>
  </system.webServer>    

</configuration>

我添加了通过elmah发送电子邮件的代码.我可以通过输入url localhost://elmah.axd看到错误.但是没有收到邮件.请帮助

I have added code to send email via elmah.I can see errors by typing in url localhost://elmah.axd.But am not getting mail.Pls help

推荐答案

尝试使用async="false":

<errorMail 
    from="join@assert.in" 
    to="twinkle@assert.in" 
    subject="Elmah Report" 
    async="false" 
    smtpServer="mail.assert.in" />

这篇关于Elmah没有发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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