コード例 #1
0
        public async Task SendWelcomeEmailAsync(User user)
        {
            var message = CreateDefaultMessage(
                "Welcome",
                user.Email,
                WelcomeTemplateId);

            AddCategories(message, new List <string> {
                AdministrativeCategoryName, "Welcome"
            });

            await _mailDeliveryService.SendEmailAsync(message);
        }
コード例 #2
0
        public async Task SendVerifyEmailEmailAsync(string email, Guid userId, string token)
        {
            var message = CreateDefaultMessage("Verify Your Email", email);
            var model   = new VerifyEmailModel
            {
                Token       = WebUtility.UrlEncode(token),
                UserId      = userId,
                WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash,
                SiteName    = _globalSettings.SiteName
            };

            await AddMessageContentAsync(message, "VerifyEmail", model);

            message.MetaData.Add("SendGridBypassListManagement", true);
            message.Category = "VerifyEmail";
            await _mailDeliveryService.SendEmailAsync(message);
        }
コード例 #3
0
        public async Task SendEmailAsync(MailMessage message)
        {
            var roll = _random.Next(0, 99);

            if (roll < _postalPercentage)
            {
                await _postalService.SendEmailAsync(message);
            }
            else
            {
                await _sesService.SendEmailAsync(message);
            }
        }
コード例 #4
0
        public async Task SendVerifyEmailEmailAsync(string email, Guid userId, string token)
        {
            var model = new Dictionary <string, string>
            {
                ["url"] = string.Format("{0}/verify-email?userId={1}&token={2}",
                                        _globalSettings.BaseServiceUri.VaultWithHash, userId, WebUtility.UrlEncode(token))
            };

            var message = await CreateMessageAsync("Verify Your Email", email, "VerifyEmail", model);

            message.MetaData.Add("SendGridBypassListManagement", true);
            await _mailDeliveryService.SendEmailAsync(message);
        }