public async Task SendConfirmEmail(string email, bool generateRealCode)
        {
            var insertedCode = await _emailVerificationCodeRepository.CreateAsync(email, generateRealCode);

            var msgData = new EmailComfirmationData()
            {
                ConfirmationCode = insertedCode.Code,
                Year             = DateTime.UtcNow.Year.ToString()
            };

            await _emailSender.SendEmailAsync(email, msgData);
        }
Exemple #2
0
        public async Task <EmailMessage> GenerateConfirmEmailMsg(EmailComfirmationData registrationData)
        {
            var templateVm = new EmailVerificationTemplate
            {
                ConfirmationCode = registrationData.ConfirmationCode,
                Year             = registrationData.Year
            };

            return(new EmailMessage
            {
                Body = await _templateGenerator.GenerateAsync("EmailConfirmation", templateVm, TemplateType.Email),
                Subject = EmailResources.EmailConfirmation_Subject,
                IsHtml = true
            });
        }
        public async Task <string> SendConfirmEmail(string email, string partnerId, bool isPriority = false)
        {
            IEmailVerificationCode emailCode;

            if (isPriority)
            {
                var expDate = DateTime.UtcNow.AddSeconds(_supportToolsSettings.PriorityCodeExpirationInterval);
                emailCode = await _emailVerificationCodeRepository.CreatePriorityAsync(email, partnerId, expDate);
            }
            else
            {
                emailCode = await _emailVerificationCodeRepository.CreateAsync(email, partnerId, _deploymentSettings.IsProduction);
            }

            var msgData = new EmailComfirmationData
            {
                ConfirmationCode = emailCode.Code,
                Year             = DateTime.UtcNow.Year.ToString()
            };

            await _emailSender.SendEmailAsync(partnerId, email, msgData);

            return(emailCode.Code);
        }