简体   繁体   English

邮件错误:SMTP服务器需要安全连接,或者客户端未通过身份验证。 服务器响应为:5.5.1需要身份验证

[英]Mail Error:The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required

I am using following code to send email. 我正在使用以下代码发送电子邮件。 The Code does not working it getting the error message 该代码不起作用,它会收到错误消息

try
{
    MailMessage message = new MailMessage(mFrom, "xyz@gmail.com",mSubject,mMsg);
    SmtpClient mySmtpClient = new SmtpClient("smtp.gmail.com",587);
    mySmtpClient.Credentials = ICredentialsByHost)CredentialCache.DefaultNetworkCredentials;
    mySmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
    mySmtpClient.UseDefaultCredentials = true;
    mySmtpClient.EnableSsl = true;
    mySmtpClient.Send(message);
}
catch (FormatException ex)
            {
                MessageBox.Show(ex.StackTrace, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (SmtpException ex)
            {
                MessageBox.Show(ex.StackTrace, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.StackTrace, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

The following SmtpException exception is been catched 已捕获以下SmtpException异常

The SMTP server requires a secure connection or the client was not authenticated. SMTP服务器需要安全连接,或者客户端未通过身份验证。 The server response was: 5.5.1 Authentication Required. 服务器响应为:5.5.1需要身份验证。

Thanks... 谢谢...

Please configure the required mail settings in the web.config based on the delivery method or host that you use. 请根据您使用的发送方式或主机在web.config中配置所需的邮件设置。

Have look at the following URL how to configure smtp settings in web.config 看了下面的URL 如何在web.config中配置SMTP设置

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:SMTP服务器需要安全连接,或者客户端未通过身份验证。 服务器响应为:5.5.1需要身份验证 - Error :The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required Gmail 错误:SMTP 服务器需要安全连接或客户端未通过身份验证。 服务器响应是:5.5.1 Authentication Required - Gmail Error :The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required SMTP服务器需要安全连接,或者客户端未通过身份验证。 服务器响应为:5.5.1需要身份验证 - SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required SMTP服务器需要安全连接,或者客户端未通过身份验证。 服务器响应为:5.5.1需要身份验证。?8 - The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.?8 SMTP 服务器需要安全连接或客户端未通过身份验证。 服务器响应是:5.5.1 需要身份验证? - The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required? SMTP服务器需要安全连接或客户端未经过身份验证。 服务器响应为5.5.1,需要身份验证 - the SMTP server requires a secure connection or the client was not authenticated. The server response was 5.5.1, Authentication required SMTP 服务器需要安全连接或客户端未通过身份验证。 服务器响应为:5.5.1 Authentication Required - The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required c# SMTP 服务器需要安全连接或客户端未通过身份验证。 服务器响应为:5.7.0 需要身份验证 - c# The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required SMTP 服务器需要安全连接或客户端未通过身份验证。 服务器响应为:5.7.0 Authentication Required - The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required SMTP 服务器需要安全连接或客户端未通过身份验证。 服务器响应为:需要 5.7.0 身份验证。 C# WFM - The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required. C# WFM
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM