gpt4 book ai didi

c# - SMTP 服务器需要安全连接或客户端未通过身份验证。如果在 godaddy 上上传

转载 作者:IT王子 更新时间:2023-10-29 04:52:00 30 4
gpt4 key购买 nike

下面的代码在本地运行良好,但是如果上传到 godaddy 则无法运行。

错误:显示

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at

Line 53:        
Line 54: smtp.EnableSsl = true;
Line 55: smtp.Send(message);
Line 56:
Line 57:

请检查下面的代码

    MailMessage message = new MailMessage();
message.From = new MailAddress(emailid.Text);

message.To.Add(new MailAddress("receiver@gmail.com"));

message.Subject = "NaatKhawan's Feedback";

message.Body = "Selected: " + DropDownList1.Text.ToString() + "<br/><br/>Name: " + name.Text.ToString() + " <br/><br/>Email: " + emailid.Text.ToString() + " <br/><br/>Contact Number: " + phone.Text.ToString() + " <br/><br/>Message:<br/> " + remabox.Text.ToString();

message.IsBodyHtml = true;

// finaly send the email:
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";

smtp.Port = 587;
smtp.Credentials = new System.Net.NetworkCredential("123@gmail.com", "123");

smtp.EnableSsl = true;
smtp.Send(message);
lbltxt.Visible = true;
name.Text = "";
emailid.Text = "";
phone.Text = "";
remabox.Text = "";

lbltxt.Text = "Thank you for supporting NaatKhawan";

最佳答案

您应该允许应用程序访问 gmail 帐户。 This link will help you

关于c# - SMTP 服务器需要安全连接或客户端未通过身份验证。如果在 godaddy 上上传,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19111325/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com