We built an ASP.NET app that we deployed on the client's server, using their SMTP server.
I'm trying to have Elmah send error emails using the ErrorEmailModule
. This uses the SMTP settings as configured in the web.config, but somehow sending emails is not working (nothing is being sent).
The SMTP settings are configured like this:
<system.net>
<mailSettings>
<smtp from="support@xxxxxx.nl">
<network host="xxxxxxx.management.local" port="25" enableSsl="true" defaultCredentials="true"/>
</smtp>
</mailSettings>
</system.net>
To test if this is a problem with Elmah or with the config I created a little test application that uses the same setting and tries to send an email:
string from = "support@xxxxxxxx.nl";
string to = ConfigurationManager.AppSettings["ErrorReportingEmail"];
var message = new MailMessage(from, to, "Test", "Test");
var smtpClient = new SmtpClient();
smtpClient.Send(message);
This doesn't work either. SmtpClient doesn't throw an error, it just acts like it sent an email, but I'm not receiving anything.
I then tried sending an email using 2 different email testing tools, called MailTester and MultiMail, I entered the same SMTP settings, and they can send emails just fine.
So my question is: why can I send emails from these mail tester apps but not from my ASP.NET app?