예제 #1
0
        public LoggingPageViewModel(ILogView logView, IClipboard <ILogView> clipboard, IMailClient <ILogView> mailClient)
        {
            LogView = logView;

            SendCommand = new DelegateCommand(() => mailClient.SendAsync(LogView));
            CopyCommand = new DelegateCommand(() => clipboard.Copy(LogView));
        }
예제 #2
0
        public Task SendMail(EmailBase email)
        {
            IMailClient   mailClient   = _emailFactory.CreateMailClient();
            IEmailBuilder emailBuilder = _emailFactory.CreateEmailBuilder();

            _emailInitializer.Initialize(emailBuilder, email);
            return(mailClient.SendAsync(emailBuilder));
        }
예제 #3
0
        public Task SendMails(IEnumerable <EmailBase> mailList)
        {
            return(Task.WhenAll(mailList.Select(email =>
            {
                IMailClient mailClient = _emailFactory.CreateMailClient();
                IEmailBuilder emailBuilder = _emailFactory.CreateEmailBuilder();

                _emailInitializer.Initialize(emailBuilder, email);
                return mailClient.SendAsync(emailBuilder);
            })));
        }
예제 #4
0
        public async Task Handle(PromocodeAddedIntegrationEvent <CompanyMailContent> @event)
        {
            _logger.LogInformation("Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.EventId, ApplicationInfo.ApplicationName, @event);

            var message = new MimeMessage();

            message.From.Add(new MailboxAddress("Exadel Info", "*****@*****.**"));
            message.To.Add(new MailboxAddress("Mr. Friend", "*****@*****.**"));
            message.Subject = "Exadel Promo";
            message.Body    = _mailBuilder.GetMessageBody(MailBodyOption.Company, LanguageOption.Ru, @event.Content);

            await _mailClient.SendAsync(message);

            await Task.CompletedTask;
        }