简体   繁体   English

SMTP服务器需要安全连接,或者客户端未在C#ASP.NET中进行身份验证

[英]The SMTP server requires a secure connection or the client was not authenticated in C# ASP.NET

I am trying to send an email but i am getting authentication failure. 我正在尝试发送电子邮件,但身份验证失败。

Do we need any specific type of authentication for Google mail. 我们是否需要任何特定类型的Google邮件身份验证。

[Error in Browser][1]
     // Created Mail message and taken inputs
    MailMessage mail = new MailMessage(from,to,subject,message);
    // Used SMTP Client
    SmtpClient client = new SmtpClient();
    // Google Port
    client.Port = 587;
    client.Credentials = new NetworkCredential(From.Text, password.Text);
    client.UseDefaultCredentials = true;
    client.DeliveryMethod = SmtpDeliveryMethod.Network;
    client.EnableSsl = true;
    client.Send(mail);
    Label.Text = "Sent Successful";

I am getting error near Send(mail) 我在发送(邮件)附近遇到错误

You're not setting the SMTP server address? 您没有设置SMTP服务器地址吗?

Assuming your credentials are correct then you should use SmtpClient client = new SmtpClient("smtp.gmail.com") and client.Port = 465 . 假设您的凭据正确无误,则应使用SmtpClient client = new SmtpClient("smtp.gmail.com")client.Port = 465 587 is for TLS 587适用于TLS

暂无
暂无

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

相关问题 asp.net中的密码恢复SMTP服务器需要安全连接或客户端未通过身份验证 - Password Recovery in asp.net The SMTP server requires a secure connection or the client was not authenticated 使用 asp.net 发送电子邮件显示此错误:SMTP 服务器需要安全连接或客户端未通过身份验证 - Send email using asp.net shows this error:The SMTP server requires a secure connection or the client was not authenticated SMTP服务器需要安全连接或客户端未经过身份验证 - The SMTP server requires a secure connection or the client was not authenticated 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 C#“其他信息:SMTP服务器需要安全连接,或者客户端未经过身份验证。” - C# “Additional information: The SMTP server requires a secure connection or the client was not authenticated.” SMTP服务器需要安全连接,或者客户端未通过身份验证-连接超时 - The SMTP server requires a secure connection or the client was not authenticated— connection timed out 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 在服务器上获取异常SMTP服务器需要安全连接或客户端未通过身份验证 - On server Getting exception The SMTP server requires a secure connection or the client was not authenticated SMTP 服务器需要安全连接或客户端未通过身份验证。 使用 c# webapplication 发送 outlook 邮件时出错 - The SMTP server requires a secure connection or the client was not authenticated. Error while sending outlook mail using c# webapplication SMTP 服务器需要安全连接或客户端未通过服务帐户身份验证 - The SMTP server requires a secure connection or the client was not authenticated for service account
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM