我不明白为什么这段代码无法正常工作。我收到一条错误消息,指出无法分配属性
MailMessage mail = new MailMessage();
SmtpClient client = new SmtpClient();
client.Port = 25;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.UseDefaultCredentials = false;
client.Host = "smtp.gmail.com";
mail.To = "user@hotmail.com"; // <-- this one
mail.From = "you@yourcompany.com";
mail.Subject = "this is a test email.";
mail.Body = "this is my test email body";
client.Send(mail);
1
诺尔说,如果你想通过SMTP通过Gmail发送你需要允许不够安全的应用访问您的帐户support.google.com/accounts/answer/6010255?hl=en
—
马修锁定