Email

 string password="ff";
            MailMessage messge = new MailMessage();
            messge.From = new MailAddress(messge.From.Address);
            messge.To.Add(new MailAddress("wjp@163.com"));
            messge.Subject = "password";
            messge.IsBodyHtml = false;

            messge.Body = "您的密码是:   " + password + "       " + DateTime.Now.ToString();
            SmtpClient sc = new SmtpClient();
            sc.Send(messge);




2.system.net>
    <mailSettings>
      <smtp deliveryMethod="Network" from="wjp@126.com">
        <network host="smtp.126.com" port="25" password="lf87" userName="wjp@126.com"/>
      </smtp>
    </mailSettings>
  </system.net>
</configuration>

原文地址:https://www.cnblogs.com/luluping/p/1214956.html