protected void BtnSubmit_Click(object sender, EventArgs e)
{
GetAllUsersName U = new GetAllUsersName();
string Email = U.GetUSEREmail(TxtEmailPass.Text);
SmtpClient mySmtpClient = new SmtpClient("smtp.gmail.com", 587);
mySmtpClient.EnableSsl = true;
mySmtpClient.UseDefaultCredentials = false;
mySmtpClient.Credentials = new NetworkCredential("Projects@gmail.com", "Pro123456789");
mySmtpClient.EnableSsl = true;
MailMessage msg = new MailMessage("Projects@gmail.com", Email, "Password", "your password is:");
mySmtpClient.Send(msg);
}
这是我的代码,但它一直告诉我:
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.
您的代码看起来不错。如果这是一个新帐户,请确保更改密码 - 至少一次。 Gmail 可能正在找您更改密码。
我是一名优秀的程序员,十分优秀!