NET v4.0中无法识别的属性'enableSsl' [英] Unrecognised attribute 'enableSsl' in .NET v4.0

查看:78
本文介绍了NET v4.0中无法识别的属性'enableSsl'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经运行了一段时间的新系统正在测试中,并且正在将电子邮件创建到文件夹中,这样它们就不会意外地发送给客户.现在我们打开了实时电子邮件,在发送时遇到了问题.

We've been running a new system in test for a while now and creating emails to a folder so they don't accidentally go out to clients. Now we've turned on live emailing we are getting issues with sending.

我正在使用ActionMailer.NET,下面是创建和发送电子邮件的代码.我不会包含视图":

I'm using ActionMailer.NET and the code to create and send the email is below. I won't include the View:

EmailResult x = new EmailController().EmailWorkOrderForApprovalToClient(model);
            System.Net.Mail.Attachment file = new System.Net.Mail.Attachment(FilePath);
            x.Mail.Attachments.Add(file);
            x.Deliver();

哪个出现错误

SMTP服务器需要安全连接,或者客户端不安全已验证.服务器响应为:5.7.57 SMTP;客户不是经过验证可在MAIL FROM期间发送匿名邮件

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM

web.config看起来像这样:

The web.config looks like this:

  <system.net>
<mailSettings>
  <smtp deliveryMethod="Network" from="ClientServices@topupconsultants.com">
    <specifiedPickupDirectory pickupDirectoryLocation="" />
    <network defaultCredentials="false" host="smtp.office365.com" password="secret" port="587" userName="ClientServices@myco.com" />
  </smtp>
</mailSettings>

我的假设是enableSsl ="true"需要添加到网络线路,但是当我这样做并尝试转到IIS中站点的SMTP电子邮件部分时,出现错误:

My assumption is that enableSsl="true" needs to be added to the network line, but when I do that and try to go to the SMTP Email section of the site in IIS, I get the error:

无法识别的属性"enableSsl"

Unrecognized attribute 'enableSsl'

我在IIS上并不那么热门,但是我检查了应用程序池及其.NET CLR版本是否为4.0.30319.我还检查了服务器上是否安装了.NET v4.5.

I'm not that hot on IIS, but I've checked that the Application Pool and its .NET CLR version is 4.0.30319. I've also checked that .NET v4.5 is installed on the server.

这让我感到困惑,我希望我不必完全将代码更改为允许我在此时指定SSL的方法.

This is baffling me, and I'm hoping I don't have to totally change my code to a method that allows me to specify SSL at that point.

推荐答案

在这里回答我自己的问题,基本上答案是:不相信错误消息".在我尝试过的所有配置中,我都认为错误消息告诉我这是不可接受的.但是,无论如何,我还是尝试了它,并且它在发送时使用了enableSsl属性,这使与Office 365的连接得以成功.

Answering my own question here, and basically the answer is: "Don't believe the error message". In all the configurations I tried, I believed the error message when it told me that is was unacceptable. However, I tried it anyway, and it uses the enableSsl attribute when it sends, and this allows the connection to Office 365 to succeed.

一个令人烦恼的IIS错误,我会在一周内忘记它,但是现在非常烦人.

Slightly irritating IIS bug that I'll forget about in a week, but right now is very annoying.

这篇关于NET v4.0中无法识别的属性'enableSsl'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆