We built an ASP.NET app that we deployed on the client's server, using their SMTP server.
我们建立了一个ASP。我们部署在客户端服务器上的NET应用程序,使用他们的SMTP服务器。
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).
我想让Elmah使用ErrorEmailModule发送错误邮件。这将使用web中配置的SMTP设置。配置,但是发送电子邮件是不工作的(什么都没有发送)。
The SMTP settings are configured like this:
SMTP设置是这样配置的:
<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:
为了测试这是否是Elmah的问题,或者配置我创建了一个小测试应用程序,使用相同的设置并尝试发送电子邮件:
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.
这并不奏效。SmtpClient不会抛出错误,它只是像发送邮件一样,但我没有收到任何东西。
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.
然后我试着用两种不同的电子邮件测试工具——MailTester和MultiMail——发送电子邮件,我输入了相同的SMTP设置,他们可以发送电子邮件。
So my question is: why can I send emails from these mail tester apps but not from my ASP.NET app?
所以我的问题是:为什么我可以从这些邮件测试应用程序中发送电子邮件,而不是从ASP中发送。网络应用程序?
1 个解决方案
#1
0
try this set deliveryMethod = network.
试试这个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>
#1
0
try this set deliveryMethod = network.
试试这个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>