public DisciturMailDef(ListDictionary replacements) { config = MailConfigProvider.GetConfiguration <T>(); MailTemplate = config.Template; Replacements = replacements; md = new MailDefinition(); md.IsBodyHtml = true; md.Subject = config.Subject; md.From = config.From; }
public async Task <bool> SendForgottenPwdEmail(string strTo, string newPassword) { System.Collections.Specialized.ListDictionary replacements = new System.Collections.Specialized.ListDictionary(); ForgottenPwdMailConfig config = MailConfigProvider.GetConfiguration <ForgottenPwdMailConfig>(); replacements.Add("<%Password%>", newPassword); DisciturMailDef <ForgottenPwdMailConfig> md = new DisciturMailDef <ForgottenPwdMailConfig>(replacements); MailMessage mm = md.CreateMailMessage(strTo); return(await this.SendEmail(mm, config.From, null)); }
public async Task <bool> SendActivationEmail(string strTo, string username, string newPassword, string activationKey, string absoluteURL) { System.Collections.Specialized.ListDictionary replacements = new System.Collections.Specialized.ListDictionary(); ActivationMailConfig config = MailConfigProvider.GetConfiguration <ActivationMailConfig>(); string fromURL = string.IsNullOrEmpty(config.ActivationURL) ? absoluteURL : config.ActivationURL; replacements.Add("<%Username%>", username); replacements.Add("<%Password%>", newPassword); replacements.Add("<%ActivationKey%>", activationKey); replacements.Add("<%ActivationUrl%>", @fromURL); replacements.Add("<%ActivationPath%>", @config.ActivationPath); DisciturMailDef <ActivationMailConfig> md = new DisciturMailDef <ActivationMailConfig>(replacements); MailMessage mm = md.CreateMailMessage(strTo); return(await this.SendEmail(mm, config.From, null)); }