如何解决消息=服务不可用,关闭传输通道.服务器响应为:4.3.2 服务不可用



C# 代码隐藏,用于向不同的用户发送邮件。 我收到错误消息=服务不可用,正在关闭传输通道。服务器响应为:4.3.2 服务不可用

SqlCommand cmd1 = new SqlCommand("select Email,Password from Login where Email =@email", con);
MailMessage msg = new MailMessage();
msg.From = new MailAddress("abc@xxx.com");//Email will be sent through this Mail
msg.To.Add(SEmail_Display.Text);//A mail will be sent to the address carried from previous page.
msg.Subject = " Recover your Password";
msg.Body = ("Your Username is:" + Email + "<br/><br/>" + "Your Password is:" + Password);
msg.IsBodyHtml = true;
SmtpClient smt = new SmtpClient();
smt.Host = "mail.yash.com";
System.Net.NetworkCredential ntwd = new NetworkCredential();
ntwd.UserName = "gd.mk"; //Credentials to access mail 
ntwd.Password = "myPassword";  
smt.UseDefaultCredentials = true;
smt.Credentials = ntwd;
smt.Port = 587;
smt.EnableSsl = true;
smt.Send(msg);

这通常是一个权限问题

请参阅对此的已接受答案:

发送自动电子邮件

最新更新