private async Task <bool> SendEmailGreetingForNewPlastMemberAsync(string userEmail, string userId)
        {
            var emailContent = await _emailContentService.GetGreetingForNewPlastMemberEmailAsync(userId);

            return(await _emailSendingService.SendEmailAsync(userEmail, emailContent.Subject, emailContent.Message,
                                                             emailContent.Title));
        }
        /// <inheritdoc />
        public async Task <bool> SendEmailGreetingAsync(string email)
        {
            var citiesUrl = ConfigSettingLayoutRenderer.DefaultConfiguration.GetSection("URLs")["Cities"];
            var user      = await _userManager.FindByEmailAsync(email);

            user.EmailSendedOnRegister = DateTime.Now;
            var emailContent = _emailContentService.GetAuthGreetingEmail(citiesUrl);

            return(await _emailSendingService.SendEmailAsync(user.Email, emailContent.Subject, emailContent.Message, emailContent.Title));
        }
        private async Task GiveUserSupporterRole(User user)
        {
            await _userManager.RemoveFromRoleAsync(user, Roles.RegisteredUser);

            await _userManager.AddToRoleAsync(user, Roles.Supporter);

            var emailContent = _emailContentService.GetCityToSupporterRoleOnApproveEmail();
            await _emailSendingService.SendEmailAsync(user.Email, emailContent.Subject, emailContent.Message,
                                                      emailContent.Title);
        }
Exemplo n.º 4
0
 public Task SendEmailAdmin(ContactsDto contactDTO)
 {
     return(_emailSendingService.SendEmailAsync(
                "*****@*****.**",
                "Питання користувачів",
                $"Контактні дані користувача : Електронна пошта {contactDTO.Email}, " +
                $"Ім'я {contactDTO.Name}," +
                $"Телефон {contactDTO.PhoneNumber}  " +
                $"Опис питання : {contactDTO.FeedBackDescription}",
                contactDTO.Email));
 }
        public async Task RemindCityAdminsToApproveFollowers()
        {
            var newFollowers = await GetNewCityFollowersAsync();

            foreach (var newFollower in newFollowers)
            {
                var cityAdmin = await GetCityAdminAsync(newFollower);

                var cityAdminDeputy = await GetCityAdminDeputyAsync(newFollower);

                var emailContent = await _emailContentService.GetCityAdminAboutNewFollowerEmailAsync(newFollower.Id,
                                                                                                     newFollower.FirstName, newFollower.LastName, true);

                await _emailSendingService.SendEmailAsync(cityAdmin.User.Email, emailContent.Subject,
                                                          emailContent.Message, emailContent.Title);

                await _emailSendingService.SendEmailAsync(cityAdminDeputy.User.Email, emailContent.Subject,
                                                          emailContent.Message, emailContent.Title);
            }
        }
Exemplo n.º 6
0
        public async Task <UserDTO> FacebookLoginAsync(FacebookUserInfo facebookUser)
        {
            var user = await _userManager.FindByEmailAsync(facebookUser.Email);

            if (user == null)
            {
                user = new User
                {
                    SocialNetworking = true,
                    UserName         = facebookUser.Email ?? facebookUser.UserId,
                    FirstName        = facebookUser.Name.Split(' ')[0],
                    Email            = facebookUser.Email ?? "*****@*****.**",
                    LastName         = facebookUser.Name.Split(' ')[1],
                    ImagePath        = "default_user_image.png",
                    EmailConfirmed   = true,
                    RegistredOn      = DateTime.Now,
                    UserProfile      = new UserProfile
                    {
                        Birthday = DateTime.Parse(facebookUser.Birthday, CultureInfo.InvariantCulture),
                        GenderID = _repoWrapper
                                   .Gender
                                   .FindByCondition(x => x.Name == facebookUser.Gender)
                                   .FirstOrDefault()?.ID,
                    }
                };
                var createResult = await _userManager.CreateAsync(user);

                if (createResult.Succeeded && user.Email != "*****@*****.**")
                {
                    var emailContent = _emailContentService.GetAuthFacebookRegisterEmail();
                    await _emailSendingService.SendEmailAsync(user.Email, emailContent.Subject, emailContent.Message, emailContent.Title);
                }
                await _userManager.AddToRoleAsync(user, Roles.RegisteredUser);
            }
            await _signInManager.SignInAsync(user, false, null);

            return(_mapper.Map <User, UserDTO>(user));
        }
Exemplo n.º 7
0
        public async Task <IActionResult> Post([FromBody] RegisterModel model)
        {
            var result = await _service.RegisterUser(model);

            if (result.Successful)
            {
                var url = Url.Action(
                    "Confirm",
                    "EmailConfirmation",
                    new { userId = result.UserId, result.Token },
                    protocol: HttpContext.Request.Scheme);

                await _emailSender.SendEmailAsync(result.UserEmail, "Password confirmation",
                                                  "Confirm your password by visiting the following link: " + url
                                                  );
            }

            return(Ok(result));
        }
        private async Task <bool> SendEmailCanceledNotificationAsync(User vaucheeUser, User vaucherUser)
        {
            var email = await _emailContentService.GetCanceledUserEmailAsync(vaucheeUser, vaucherUser);

            return(await _emailSendingService.SendEmailAsync(vaucheeUser.Email, email.Subject, email.Message, email.Title));
        }