public static FluentEmailServicesBuilder AddGraphSender(
     this FluentEmailServicesBuilder builder,
     GraphSenderOptions options)
 {
     builder.Services.TryAdd(ServiceDescriptor.Scoped <ISender>(_ => new GraphSender(options)));
     return(builder);
 }
コード例 #2
0
        public GraphSender(GraphSenderOptions options)
        {
            this.saveSent = options.SaveSentItems ?? true;

            ClientSecretCredential spn = new ClientSecretCredential(options.TenantId, options.ClientId, options.Secret);

            this.graphClient = new (spn);
        }
        public static FluentEmailServicesBuilder AddGraphSender(
            this FluentEmailServicesBuilder builder,
            string graphEmailClientId,
            string graphEmailTenantId,
            string graphEmailSecret,
            bool saveSentItems = false)
        {
            var options = new GraphSenderOptions
            {
                ClientId      = graphEmailClientId,
                TenantId      = graphEmailTenantId,
                Secret        = graphEmailSecret,
                SaveSentItems = saveSentItems,
            };

            return(builder.AddGraphSender(options));
        }