Ejemplo n.º 1
0
    private async Task SendEmployeeReportAsync(Employee employee, IGateway mailGateway, CancellationToken cancel = default)
    {
        _logger.LogInformation("Отправка отчета по пользователю {0}", employee.Name);
        if (employee is null)
        {
            throw new ArgumentNullException(nameof(employee));
        }

        string report = await _report.CreateAsync(employee, cancel).ConfigureAwait(false);

        var message = new Message
        {
            Body    = report,
            Subject = "Заказы сотрудника",
            IsHtml  = true,
            Name    = "Сервис отправки сообщений",
            To      = "*****@*****.**"
        };

        await mailGateway.SendAsync(message, cancel);
    }