示例#1
0
        private static void SendVerificationEmail(User user)
        {
            //Send the Validate Email Address Email

            //Changed to UserID GUID to prevent problems with duplicate email addresses.
            var validateUrl = string.Format("{0}account/validate/{1}", App.BaseUrl, Helpers.base64Encode(user.ID.ToString()));

            var parser = new TemplateParser();
            var replacements = new Dictionary<string, string>
                                   {
                                       {"[FIRST_NAME]", user.FirstName},
                                       {"[VALIDATE_ACCOUNT_URL]", validateUrl},
                                       {"[year]", DateTime.Now.Year.ToString(CultureInfo.InvariantCulture) }
                                   };

            var message = parser.Replace(AccountEmails.ValidateEmail, replacements);

            var sfEmail = new SpamSafeMail
            {
                EmailSubject = "Epilogger.com - Please validate your email address",
                HtmlEmail = message,
                TextEmail = message
            };
            sfEmail.ToEmailAddresses.Add(user.EmailAddress);
            sfEmail.SendMail();
        }
示例#2
0
        private static void SendWelcomeEmail(User user)
        {
            //Send the user the Welcome Email

            var parser = new TemplateParser();
            var replacements = new Dictionary<string, string>
                                   {
                                       {"[FIRST_NAME]", user.FirstName},
                                       {"[year]", DateTime.Now.Year.ToString(CultureInfo.InvariantCulture) }
                                   };

            var message = parser.Replace(AccountEmails.WelcomeEmail, replacements);

            var sfEmail = new SpamSafeMail
            {
                EmailSubject = "Welcome to epilogger.com!",
                HtmlEmail = message,
                TextEmail = message
            };
            sfEmail.ToEmailAddresses.Add(user.EmailAddress);
            sfEmail.SendMail();
        }