示例#1
0
        public static void UseSmtp4dev(this IServiceCollection services)
        {
            SettingsStore settingsStore = new SettingsStore();

            services.AddInstance <ISettingsStore>(settingsStore);

            string dbDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Smtp4dev");

            Directory.CreateDirectory(dbDirectory);
            FileInfo dbFile = new FileInfo(Path.Combine(dbDirectory, "Smtp4dev.db"));

            MessageStore messageStore = new MessageStore(dbFile);

            services.AddInstance <IMessageStore>(messageStore);

            services.AddSingleton <ISmtp4devEngine, Smtp4devEngine>();
        }