最近我的gmail邮件发送密码失败了
本文关键字:密码 失败 我的 gmail 最近 | 更新日期: 2023-09-27 18:17:03
我用这个代码发送邮件与gmail!以前它工作得很好,但现在它失败了!(它是在c#和表单应用程序)
cmdSend.Text = "Wait!";
cmdSend.Enabled = false;
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
var mail = new MailMessage();
mail.From = new MailAddress(txtMailAddressFrom.Text);
mail.To.Add(txtMailAddressTo.Text);
mail.Subject = txtSubject.Text;
mail.IsBodyHtml = true;
string htmlBody;
htmlBody = txtMailBody.Text;
mail.Body = htmlBody;
SmtpServer.Port = 578;
SmtpServer.UseDefaultCredentials = false;
SmtpServer.Credentials = new System.Net.NetworkCredential(txtMailAddressFrom.Text, txtPassword.Text);
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
SmtpServer.Dispose();
cmdSend.Text = "Send";
cmdSend.Enabled = true;
我测试了端口465,但不工作!
Gmail不使用端口587而不是578吗?