我正在尝试使用免费的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);