public async Task Execute(AuthMessageSenderOptions authOptions, string subject, string message, string email)
        {
            Console.WriteLine(JsonSerializer.Serialize(authOptions));

            var confidentialClientApplication = ConfidentialClientApplicationBuilder
                                                .Create(authOptions.ClientID)
                                                .WithTenantId(authOptions.TenantID)
                                                .WithClientSecret(authOptions.ClientSecret)
                                                .Build();

            var authProvider = new ClientCredentialProvider(confidentialClientApplication);

            var graphClient = new GraphServiceClient(authProvider);

            var messageClass = new Message
            {
                Subject = subject,
                Body    = new ItemBody
                {
                    ContentType = BodyType.Html,
                    Content     = message
                },
                Sender = new Recipient
                {
                    EmailAddress = new EmailAddress
                    {
                        Address = authOptions.Sender
                    }
                },
                From = new Recipient
                {
                    EmailAddress = new EmailAddress
                    {
                        Address = authOptions.From
                    }
                },
                ToRecipients = new Recipient[]
                {
                    new Recipient
                    {
                        EmailAddress = new EmailAddress
                        {
                            Address = email
                        }
                    }
                }
            };

            await graphClient
            .Users[authOptions.Sender]
            .SendMail(messageClass)
            .Request()
            .PostAsync();
        }
 public EmailSender(IOptions <AuthMessageSenderOptions> optionsAccessor)
 {
     Options = optionsAccessor.Value;
 }