Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6667057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:53:36+00:00 2026-05-26T02:53:36+00:00

I am using ELMAH for my MVC 3 application with Gmail. I have used

  • 0

I am using ELMAH for my MVC 3 application with Gmail. I have used several references on how to do this, including This StackOverflow Question, which goes over multiple fixes

I am still unable to determine why I am not getting emails from elmah. I am attempting to test this by throwing a NullReferenceException in my code that I am calling.

My web.config looks like the following:

     <configuration>
  <configSections>
    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
    </sectionGroup>
    <sectionGroup name="elmah">
      <section name="errorMail" requirePermission="false"  type="Elmah.ErrorMailSectionHandler, Elmah"/>
      <section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah"/>
      <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah"/>
      <section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah"/>
    </sectionGroup>
  </configSections>

  <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>

  <appSettings>
    <add key="webpages:Enabled" value="false" />
  </appSettings>
  <system.web>
    <httpHandlers>
      <add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
      <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah"/>
    </httpHandlers>
    <httpModules>
      <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah"/>
      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
      <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah"/>
    </httpModules>

    <!--
        Enabling request validation in view pages would cause validation to occur
        after the input has already been processed by the controller. By default
        MVC performs request validation before a controller processes the input.
        To change this behavior apply the ValidateInputAttribute to a
        controller or action.
    -->
     <pages
        validateRequest="false"
        pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
        pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
        userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <controls>
        <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
      </controls>
      </pages>
      </system.web>
      <system.net>
    <mailSettings>
      <smtp deliveryMethod="Network">
        <network host="smtp.gmail.com" port="587" userName="username@gmail.com" password="myPassword"/>
      </smtp>
    </mailSettings>
    </system.net>
    <elmah>
    <errorMail   from="fromAddress@gmail.com" to="toAddress@gmail.com" subject="Error" async="true" smtpPort="587"       useSsl="true"/>
    </elmah>
    <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />

      <handlers>
      <remove name="BlockViewHandler"/>
      <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode"    type="System.Web.HttpNotFoundHandler" />
      <add name="Elmah" verb="POST,GET,HEAD" path="elmah.axd"      type="Elmah.ErrorLogPageFactory, Elmah"/>
    </handlers>

    <modules runAllManagedModulesForAllRequests="true">
      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
      <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
      <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
    </modules>
    </system.webServer>
    </configuration>

Any ideas on why this might not be working?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:53:36+00:00Added an answer on May 26, 2026 at 2:53 am

    EDIT: This may not be necessarily true looking at other ELMAH configurations, but you may want to try this anyways. Also, I know that the enableSSL attribute on the system.net mail settings is new in .NET 4.0 – you might want to add enableSSL=true in that section as well since GMail does use SSL to connect.

    It looks like you left your host configuration property and a few other settings out of your ELMAH settings for email when comparing your setup to those of other ELMAH configurations. I don’t think ELMAH looks at the system.net mail settings, but rather it’s own errorMail tag

    This:

    <elmah>
        <errorMail 
          from="fromAddress@gmail.com"
           to="toAddress@gmail.com"
           subject="Error"
           async="true"
           smtpPort="587"
           useSsl="true"/>
        </elmah>
    

    Should be changed to this:

    <elmah>
        <errorMail 
          from="fromAddress@gmail.com"
           to="toAddress@gmail.com"
           subject="Error"
           async="true"
           smtpPort="587"
           useSsl="true"
           host="smtp.gmail.com"
           userName="username@gmail.com"
           password="myPassword"/>
        </elmah>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are using ELMAH to log the web application exception which works great!. Also
We have integrated ELMAH with ASP.NET MVC 3, as a way to log application
I have created a website using ASP.NET MVC and use ELMAH for error handling,
I have a strange issue with an Asp.NET MVC application. Using Asp.NET MVC 3
I have an asp.net mvc 3 application. In this application I have a reminder
I'm using the suggestion from this question: How to get ELMAH to work with
I have a 3-tier web application using MVC - WCF - MSSQL . I
We're using ELMAH for handling errors in our ASP.Net MVC c# application and in
I have used ELMAH in the past using an hMailServer, but unfortunately, I am
I'm using ELMAH to handle the exceptions in my ASP.Net MVC project. I would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.