Why does System.Net.Mail work in one part of my c#.net web app, but not in another?

Posted by Marc on Stack Overflow See other posts from Stack Overflow or by Marc
Published on 2010-06-08T15:13:25Z Indexed on 2010/06/08 15:42 UTC
Read the original article Hit count: 251

I have a web application that is running on IIS within my company's domain, and is being accessed via intranet. I have this application sending out email based on some user actions. For example, its a scheduling application in part, so if a task is completed, an email is sent out notifying other users of that.

The problem is, the email works flawlessly in some cases, and not at all in others. I have a login.aspx page which sends out report emails when the page is loaded (its loaded once a day via windows task scheduler) - this always seems to work perfectly. I have an update page which is supposed to send email when text is entered and the "Update" button is clicked - this operation will fail most of the time. Both of these tasks use the same static overloaded method I wrote to send email using System.Net.Mail.

I have tried using gmail as my smtp server (instead of our internal one), and get the same results.

I investigated whether having the local SMTP Service running makes any difference, and it doesn't seem to. Besides, since C# is server-side code, shouldn't it only matter whats running on the server, and not the client?

Please help me figure out whats wrong! Where should I look? What can I try?

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET