如何使此代码发送新生成的密码或用户发送旧密码?
我想出了如何让代码发送电子邮件!发送者不是问题,但接收者才是问题。WhereEmailAdresNaar
必须替换为某人放入文本框或其他内容的电子邮件。
public void SendEmail()
{
string emailAdresVan = "invoerenSVP";
string password = "invoerenSVP";
MailMessage msg = new MailMessage();
msg.From = new MailAddress(emailAdresVan);
msg.To.Add(new MailAddress(EmailAdresNaar));
msg.Subject = Onderwerp;
msg.Body = Bericht;
msg.IsBodyHtml = true;
SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587);
NetworkCredential loginInfo = new NetworkCredential(emailAdresVan, password);
smtpClient.EnableSsl = true;
smtpClient.UseDefaultCredentials = true;
smtpClient.Credentials = loginInfo;
smtpClient.Send(msg);
}
}
}