Tried every possible setting found on stackoverflow and the Internet but no luck. Wish the developer of ELMAH had insight to show messages from ELMAH itself. ELMAH xml logging works fine.
Hope someone here will point out misconfiguration in web.config
<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>
<modules runAllManagedModulesForAllRequests="true">
<remove name="ErrorLog" />
<remove name="ErrorMail" />
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
</modules>
<errorMail from="from email" to="to email" subject="elmah exception" smtpServer="smtp.gmail.com" port="587" userName="xxxx@gmail.com" password="gmailpassword" useSsl="true" async="true" >
</errorMail>
Have tried user name without @gmail. Have tried locally installed server in errorMail settings but no help. The locally installed server works fine otherwise.
Have also tried this:
<system.net>
<mailSettings>
<smtp deliveryMethod="Network">
<network host="smtp.gmail.com" port="587" userName="xxxxxxxxxxx" password="xxxxx" />
</smtp>
</mailSettings>
</system.net>
used these settings for local smtp server:
<errorMail from="from email" to="to email" subject="elmah exception" smtpServer="xxx IP address of smtpserver" port="25" userName="xxxxx" password="xxxx" async="true" >
</errorMail>
All in all, I have tried all combinations, different settings, different SMTP servers.... no luck. Don't know if there is some message somewhere from ELMAH that I can see to know why ELMAH not connecting to STMP.
As stated above, I went through every post on this site that talks about ELMAH email and followed the instructions... but still couldn't make it work.
Also tried local smtp pickup directory
<smtp deliveryMethod="specifiedPickupDirectory">
<specifiedPickupDirectory pickupDirectoryLocation="C:\inetpub\mailroot\Pickup" />
</smtp>
and monitored the directory. Saw no activity in the folder.
Using ELMAH 1.2