问题描述
SMTP服务器要求安全连接或客户端未通过身份验证。服务器响应为:5.7.0必须首先发出STARTTLS命令。 k12sm3795394wby.16
说明:当前Web请求的执行过程中发生未处理的异常。请检查堆栈跟踪有关该错误的详细信息以及它起源于code。
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
异常详细信息:System.Net.Mail.SmtpException:SMTP服务器要求安全连接或客户端未通过身份验证。服务器响应为:5.7.0必须首先发出STARTTLS命令。 k12sm3795394wby.16
Exception Details: System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first. k12sm3795394wby.16
源错误
我使用的CreateUserWizard ..它的属性中,我使用设计器(VS2010)设定一个邮件选项。当我用code,它的工作!但与对照它不。我不知道为什么!
I am using createUserWizard.. it has a mailing option in its properties that i set using the designer (VS2010). When I used code it worked!, but with that control it doesnt. I wonder why!!
下面是我的web.config文件:
Here is my web.config file:
<system.net>
<mailSettings>
<smtp from="[email protected]">
<network host="smtp.gmail.com" defaultCredentials="false"
port="587" userName="**********" password="*****"/>
</smtp>
</mailSettings>
</system.net>
但我怀疑该控件使用该设置。
But I doubt the control uses that setting.
推荐答案
Gmail要求您使用安全连接。这可以在你的web.config中设置这样的:
Gmail requires you to use a secure connection. This can be set in your web.config like this:
<network host="smtp.gmail.com" enableSsl="true" ... />
这篇关于SMTP服务器要求安全连接或客户端未通过身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!