예제 #1
0
        public void Handle(AddEmailMessageCommand command)
        {
            var client = new EmailClient(ChannelFactory.Create("https://localhost:5003"));

            client.AddEmailMessage(new Notification.Grpc.AddEmailMessageRequest
            {
                Message = new Notification.Grpc.EmailMessage
                {
                    From    = command.EmailMessage.From,
                    Tos     = command.EmailMessage.Tos,
                    CCs     = command.EmailMessage.CCs ?? string.Empty,
                    BCCs    = command.EmailMessage.BCCs ?? string.Empty,
                    Subject = command.EmailMessage.Subject,
                    Body    = command.EmailMessage.Body,
                },
            });
        }
예제 #2
0
        public void Handle(AddEmailMessageCommand command)
        {
            var client = new EmailClient(ChannelFactory.Create(_configuration["Services:Notification:Grpc"]));

            client.AddEmailMessage(new Notification.Grpc.AddEmailMessageRequest
            {
                Message = new Notification.Grpc.EmailMessage
                {
                    From    = command.EmailMessage.From,
                    Tos     = command.EmailMessage.Tos,
                    CCs     = command.EmailMessage.CCs ?? string.Empty,
                    BCCs    = command.EmailMessage.BCCs ?? string.Empty,
                    Subject = command.EmailMessage.Subject,
                    Body    = command.EmailMessage.Body,
                },
            });
        }
예제 #3
0
        public void Handle(AddEmailMessageCommand command)
        {
            var token   = _httpContextAccessor.HttpContext.GetTokenAsync(OpenIdConnectParameterNames.AccessToken).GetAwaiter().GetResult();
            var headers = new Metadata
            {
                { "Authorization", $"Bearer {token}" },
            };

            var client = new EmailClient(ChannelFactory.Create(_configuration["Services:Notification:Grpc"]));

            client.AddEmailMessage(new Notification.Grpc.AddEmailMessageRequest
            {
                Message = new Notification.Grpc.EmailMessage
                {
                    From    = command.EmailMessage.From,
                    Tos     = command.EmailMessage.Tos,
                    CCs     = command.EmailMessage.CCs ?? string.Empty,
                    BCCs    = command.EmailMessage.BCCs ?? string.Empty,
                    Subject = command.EmailMessage.Subject,
                    Body    = command.EmailMessage.Body,
                },
            }, headers);
        }