c# - Can't send mail from server -
we built asp.net app deployed on client's server, using smtp server.
i'm trying have elmah send error emails using erroremailmodule
. uses smtp settings configured in web.config, somehow sending emails not working (nothing being sent).
the smtp settings configured 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 problem elmah or config created little test application uses same setting , tries send email:
string = "support@xxxxxxxx.nl"; string = 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 error, acts sent email, i'm not receiving anything.
i tried sending email using 2 different email testing tools, called mailtester , multimail, entered same smtp settings, , can send emails fine.
so question is: why can send emails these mail tester apps not asp.net app?
try set deliverymethod = network.
<system.net> <mailsettings> <smtp from="support@xxxxxx.nl" deliverymethod="network"> <network host="xxxxxxx.management.local" port="25" enablessl="true" defaultcredentials="true"/> </smtp> </mailsettings> </system.net>
Comments
Post a Comment