下面的代碼在本地工作正常,但如果上傳它上godaddy它不工作。SMTP服務器需要安全連接或客戶端未通過身份驗證。如果上傳上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:
PLZ檢查下面的代碼
MailMessage message = new MailMessage();
message.From = new MailAddress(emailid.Text);
message.To.Add(new MailAddress("[email protected]"));
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("[email protected]", "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";
這是什麼樣的鏈接?它有什麼作用?我是否需要在所有要使用我的帳戶的計算機上運行它? – Robert
看看http://stackoverflow.com/questions/34851484/how-to-send-an-email-in-net-according-to-new-google-security-policies – 2016-01-20 08:28:25