使用免费的Google电子邮件服务器时如何通过电子邮件发送失败错误

时间:2019-10-04 10:58:42

标签: email smtp sendmail

我正在尝试使用免费的Google电子邮件服务器从代码中发送和发送电子邮件,但电子邮件发送失败,任何人都可以帮忙。这是我的代码的电子邮件部分

MailMessage mm=new MailMessage();
mm.To.Add("xxx@yahoo.com");
mm.From=new MailAddress("yyy@gamil.com");
mm.Subject="test";
mm.Body="Hello";
SmtpClient smtp= new SmtpClient();`enter code here`
smtp.UseDefaultCredentials = false;
smtp.Credentials = new System.Net.NetworkCredential(yyyy@gmail.com, "xxxxxxx");
smtp.EnableSsl = true;
smtp.Host = "smtp.gmail.com";
smtp.Port = 465;
smtp.Send(mm);

0 个答案:

没有答案