Пример #1
0
        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));
        }
Пример #2
0
        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));
        }