示例#1
0
        public SendGridEmailProvider(IEmailProviderOptions options)
        {
            this.apiKey = options.Parameters["Key"];

            if (string.IsNullOrWhiteSpace(this.apiKey))
            {
                throw new ArgumentNullException("apiKey");
            }
        }
示例#2
0
        public SmtpEmailProvider(IEmailProviderOptions options)
        {
            this.host = options.Parameters["Host"];
            if (string.IsNullOrWhiteSpace(this.host))
            {
                throw new ArgumentNullException("Host");
            }

            var portString = options.Parameters["Port"];

            if (string.IsNullOrWhiteSpace(portString) || !int.TryParse(portString, out this.port))
            {
                throw new ArgumentException("Port");
            }

            this.username = options.Parameters["UserName"];
            this.password = options.Parameters["Password"];
        }
示例#3
0
 public InMemoryEmailProvider(IEmailProviderOptions options, IInMemoryEmailRepository inMemoryEmailRepository)
 {
     this.inMemoryEmailRepository = inMemoryEmailRepository;
 }
示例#4
0
 public IEmailProvider BuildProvider(IEmailProviderOptions options)
 {
     return(new SmtpEmailProvider(options));
 }
示例#5
0
 public IEmailProvider BuildProvider(IEmailProviderOptions providerOptions)
 {
     return(EmailProvider);
 }
示例#6
0
 public IEmailProvider BuildProvider(IEmailProviderOptions options)
 {
     return(new InMemoryEmailProvider(options, this.inMemoryEmailRepository));
 }