public virtual async Task SendEmailVerificationMessage(string email, string recipientName, string link, string appTitle)
 {
     await _emailProvider?.SendMessage(email,
                                       string.Format(Resx.AppResources.UserActivationEmailSubject, appTitle),
                                       string.Format(Resx.AppResources.UserActivationEmailBody, recipientName, link, appTitle)
                                       );
 }
Esempio n. 2
0
        private async Task EmailConfirmation(ApplicationUser user, Uri uri)
        {
            string email   = user.Email;
            string subject = ApplicationConstants.CONFIRMATION_EMAIL_SUBJECT;

            string token = await _userManager.GenerateEmailConfirmationTokenAsync(user);

            string tokenHtmlVersion = HttpUtility.UrlEncode(token);

            string linkAddress = $"{uri}Account/FinishRegistration?userId={user.Id}&token={tokenHtmlVersion}&username={user.UserName}";

            string solutionDir = Directory.GetCurrentDirectory();
            string path        = $"{solutionDir}{ApplicationConstants.PATH_TO_CONFIRMATION_EMAIL_TEMPLATE}";

            var body = string.Empty;

            using (var reader = new StreamReader(path))
            {
                body = reader.ReadToEnd();
            }

            body = body.Replace("{UserName}", user.UserName);
            body = body.Replace("{Name}", user.FirstName);
            body = body.Replace("{Action_url}", linkAddress);

            await _emailProvider.SendMessage(email, subject, body);
        }
Esempio n. 3
0
        public async Task UpdateFilters(string applicationUserId)
        {
            if (applicationUserId == null)
            {
                throw new ArgumentNullException(nameof(applicationUserId));
            }
            var applicationUser = await unitOfWork.UserManager.FindByIdAsync(applicationUserId);

            var newLotDtosModels = new List <NewLotDtosModel>();

            foreach (var filter in applicationUser.Filters)
            {
                var newLotDtosModel = await lotService.UpdateLots(filter.Id);

                if (newLotDtosModel.FreshLots.Any())
                {
                    newLotDtosModels.Add(newLotDtosModel);
                }
            }
            if (newLotDtosModels.Any())
            {
                emailProvider.SendMessage(new NotificationMessage(applicationUser.Email, SendNotificationLinkHelper.Title, SendNotificationLinkHelper.Subject),
                                          new NotificationMessageContext(newLotDtosModels));
            }
        }
Esempio n. 4
0
 public bool Send(IEmailProvider provider)
 {
     return(provider.SendMessage(this));
 }
Esempio n. 5
0
		public bool Send(IEmailProvider provider)
		{
			return provider.SendMessage(this);
		}