public async Task <string> //SendByQuestionaryIdResponse>
        SendByQuestionaryIdAsync(
            SendByQuestionaryIdRequest questionaryIdRequest)
        {
            //fake get email list from application/domain/infrastructure
            //this list comes from everyone registered to the questionary
            //var questionaryEmails = _application.GetFormattedEmailsByQuestionaryId(questionaryIdRequest.QuestionaryId);
            var emailRequests = new List <EmailRequest>
            {
                new EmailRequest
                {
                    EvaluationId = Guid.NewGuid(),
                    Recipient    = "*****@*****.**",
                    Subject      = "Asd asd asd",
                    Content      = "Asd asd asd",
                },
                new EmailRequest
                {
                    EvaluationId = Guid.NewGuid(),
                    Recipient    = "*****@*****.**",
                    Subject      = "Zxc zxc zxc",
                    Content      = "Zxc zxc zxc",
                }
            };

            var emailServiceClient = new EmailServiceClient();
            var emailResponses     = await emailServiceClient.SendEmailAsync(emailRequests);

            emailServiceClient.Close();

            //log emailResponses

            //return new SendByQuestionaryIdResponse();
            var responseMessage = string.Join(",", emailResponses.Select(x => $"{x.Recipient}-{x.Status}"));

            return($"ManualEmailSender: {responseMessage}");
        }
Exemplo n.º 2
0
 public async Task SendEmailAsync(string email, string subject, string message)
 {
     EmailServiceClient client = ClientFactory.CreateEmailServiceClient();
     await client.SendEmailAsync(email, subject, message);
 }