Exemple #1
0
        public SmtpCommandFactoryTests()
        {
            var options = new SmtpServerOptions {
                ServerName = "test.smtp.com"
            };

            _smtpCommandFactory = new SmtpCommandFactory(options, new SmtpParser());
        }
        public ISmtpServerOptions GetSmtpServerOptions()
        {
            var result     = new SmtpServerOptions();
            var smtpServer = Get(SmtpServer);

            if (smtpServer != null)
            {
                result.SmtpServer         = (string)smtpServer;
                result.SmtpServerPort     = Convert.ToInt32(Get(SmtpServerPort));
                result.SmtpServerUseSSl   = Convert.ToBoolean(Get(SmtpSslEncryption));
                result.SmtpAuthentication = Convert.ToInt32(Get(SmtpAuthentication));
                result.SmtpServerUser     = productionCipher.Decrypt((string)Get(SmtpServerUsername), encryptorKey);
                result.SmtpServerPassword = productionCipher.Decrypt((string)Get(SmtpServerPassword), encryptorKey);
            }
            return(result);
        }
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllersWithViews();
            services.AddCors((options) =>
            {
                options.AddDefaultPolicy((policyBuilder) => {
                    policyBuilder.AllowAnyOrigin();
                    policyBuilder.AllowAnyMethod();
                    policyBuilder.AllowAnyHeader();
                });
            });

            var serverOptions = new SmtpServerOptions();

            this.Configuration.GetSection("SmtpServer").Bind(serverOptions);

            switch (serverOptions.DataSource.ToLowerInvariant())
            {
            case "Postgres":
                services.AddPostgresStores(this.Configuration.GetSection("PostgresConnection"));
                break;

            default:
                services.AddInMemoryStores();
                break;
            }

            services.AddCoreBitBucket();
            services.Configure <SmtpServerOptions>(this.Configuration.GetSection("SmtpServer"));

            services.AddSingleton <IModelConverter, DefaultModelConverter>();
            services.AddSingleton <IDataEncryptor, DefaultDataEncryptor>();

            services.AddSpaStaticFiles(configuration =>
            {
                configuration.RootPath = "ClientApp/build";
            });
        }
        public SmtpCommandFactoryTests()
        {
            var options = new SmtpServerOptions { ServerName = "test.smtp.com" };

            _smtpCommandFactory = new SmtpCommandFactory(options, new SmtpParser());
        }