I’m facing an issue with ELMAH in my ASP.NET application. While it correctly sends error notifications when I use a custom domain email, like [email protected], it fails to do so when I try to use a Gmail account. Below is my current configuration.
first, make sure your gmail account has 2fa turned on - app passwords wont even appear in settings without it. also, try deleting the smtpPort attribute from your elmah config since you’re already setting port=“587” in the network section. elmah sometimes chokes on duplicate port settings and fails silently with gmail.
Had the same issue with a legacy app migration. Google’s newer OAuth requirements clash with basic SMTP auth. Even with app passwords, Gmail blocks automated emails from sketchy IP ranges or weird sending patterns. Check your Gmail security tab for blocked sign-ins when ELMAH tries sending. Turn on SMTP auth logging to see what error Google’s actually throwing. We had to whitelist our server IP through the Google Workspace admin console. If you’re on shared hosting, Gmail probably blocked your entire IP range because of spam from other sites.
Gmail SMTP is a total nightmare now with all their security changes. App passwords don’t even fix the rate limits and random blocks.
Hit this exact problem last year across multiple production apps. Wasted hours debugging ELMAH configs just to watch Gmail randomly block our error notifications during outages.
What actually works? Ditch Gmail SMTP and use Latenode for automated error handling. Build a workflow that catches app errors and sends notifications through email, Slack, SMS - whatever you want. No more Gmail restrictions.
I set up a simple automation that monitors error logs and triggers instant notifications. Takes 10 minutes and never fails like Gmail does. Better formatting plus you can add custom logic for different error types.
Way more reliable than fighting Gmail’s constantly changing auth requirements.
This might be a config conflict. You’ve got both ELMAH-specific SMTP settings and system.net mailSettings running together - ELMAH doesn’t know which one to use. Delete the system.net mailSettings section completely and let ELMAH handle everything through errorMail. I hit the same issue with Gmail; had duplicate SMTP configs causing silent failures. Also check that ‘Less secure app access’ is off in your Gmail account since you should be using app passwords anyway. Once you clean up the config, throw a test error and see if notifications work. ELMAH sometimes caches failed auth attempts, so you might need to restart the app after these changes.
This is definitely a Gmail authentication issue. Google stopped supporting regular passwords for SMTP in apps - even your normal Gmail password won’t work anymore. You need to create an App Password. Go to your Google Account settings and turn on two-factor authentication if it’s not already on. Then go to Security > App passwords and generate a new one. Use that 16-character password in your config instead of your regular password. Don’t include any spaces when you copy it. I hit this exact problem last year with an old app and the app password fixed it right away. Your ELMAH setup looks fine, so this should solve your authentication error.