Пример #1
0
 public void SendRegistrationMailWithPasswordTemplate(string token, string templatePath, User user)
 {
     Task.Run(() =>
     {
         try
         {
             using (new LocaleSwitcher(user.Locale))
             {
                 var model = new EmailWithPassword
                 {
                     Name     = user.Name,
                     Link     = FormatUrl(_contextService.UrlRoute(RouteEnum.Default, new { controller = "Account", action = "EmailConfirmation", value = token, user.UserId }), user.UserId, "EmailConfirmation", false),
                     Login    = user.Email,
                     Password = user.AuthPassword
                 };
                 var mailSender = new MailServiceSendGrid(ConfigSettingsService.Get("NotificationMailSettingsSendGrid"), _logService);
                 var template   = mailSender.SendMailUsingTemplateFromFile(user.Email, MailResources.Registration_confirmation, model, templatePath);
                 MailsLog(template, user.Email, user.UserId, MailResources.Registration_confirmation, templatePath);
             }
         }
         catch (Exception ex)
         {
             _logService.Error("SendRegistrationConfirmationTemplate", ex);
         }
     });
 }
Пример #2
0
        public void SendShareMessageEmailOnRegistration(string mail, string templatePath, long userId, int numberOfShipments)
        {
            var mailSender = new MailServiceSendGrid(ConfigSettingsService.Get("NotificationMailSettingsSendGrid"), _logService);
            var model      = new ShareMessageEmail
            {
                Email = mail,
                Link  = FormatUrl("/register?share=" + userId, userId, "findfriend", false, (numberOfShipments == 0 ? null : numberOfShipments.ToString()))
            };
            var subj     = "Одна из ваших подруг зарегистрировалась на KinkyLove";
            var template = mailSender.SendMailUsingTemplateFromFile(mail, subj, model, templatePath);

            MailsLog(template, mail, userId, subj, templatePath);
        }
Пример #3
0
        public void SendShareMessageEmail(string mail, string templatePath, UserViewModel user, int numberOfShipments)
        {
            var mailSender = new MailServiceSendGrid(ConfigSettingsService.Get("NotificationMailSettingsSendGrid"), _logService);
            var model      = new ShareMessageEmail
            {
                User  = user,
                Email = mail,
                Link  = FormatUrl("/register?share=" + user.UserId, user.UserId, "ShareForPremium", false, (numberOfShipments == 0 ? null : numberOfShipments.ToString()))
            };
            var subj     = user.NameFull + " " + MailResources.Sent_you + " " + MailResources.Message;
            var template = mailSender.SendMailUsingTemplateFromFile(mail, subj, model, templatePath, user.Name);

            MailsLog(template, mail, user.UserId, subj, templatePath);
        }
Пример #4
0
 public void SendTemplateSync(string email, string subject, object model, string templatePath, long userId, string displayName = null)
 {
     try
     {
         var mailSender = new MailServiceSendGrid(ConfigSettingsService.Get("NotificationMailSettingsSendGrid"), _logService);
         var template   = mailSender.SendMailUsingTemplateFromFile(email, subject, model, templatePath, displayName);
         if (userId > -1)
         {
             MailsLog(template, email, userId, subject, templatePath);
         }
     }
     catch (Exception ex)
     {
         _logService.Error("SendTemplateSync: " + templatePath + " userId:" + userId, ex);
     }
 }