C#程式設計 忘記密碼功能的實現方法
阿新 • • 發佈:2019-02-01
{
//從Web.config獲取發信人地址、郵件標題、郵件使用者名稱和密碼以及SmtpServer
string sender = System.Configuration.ConfigurationSettings.AppSettings["mainSender"];
string title = System.Configuration.ConfigurationSettings.AppSettings["mailTitle"];
string mailUser = System.Configuration.ConfigurationSettings.AppSettings[ "mailUser"];
string mailPwd = System.Configuration.ConfigurationSettings.AppSettings["mailPwd"];
string smtpServer = System.Configuration.ConfigurationSettings.AppSettings["mailSmtpServer"];
//發信
try
{
Mail.CDOsendmail(sender, email, title, "您在eshop的密碼已找回,新密碼為"+newPassword
, mailUser, mailPwd, smtpServer);
}
catch(Exception ex)
{
thrownew Exception(ex.Message);
}
}
//從Web.config獲取發信人地址、郵件標題、郵件使用者名稱和密碼以及SmtpServer
string sender = System.Configuration.ConfigurationSettings.AppSettings["mainSender"];
string title = System.Configuration.ConfigurationSettings.AppSettings["mailTitle"];
string mailUser = System.Configuration.ConfigurationSettings.AppSettings[
string mailPwd = System.Configuration.ConfigurationSettings.AppSettings["mailPwd"];
string smtpServer = System.Configuration.ConfigurationSettings.AppSettings["mailSmtpServer"];
//發信
try
{
Mail.CDOsendmail(sender, email, title, "您在eshop的密碼已找回,新密碼為"+newPassword
, mailUser, mailPwd, smtpServer);
catch(Exception ex)
{
thrownew Exception(ex.Message);
}
}