Пример #1
0
        public void SendEmail2()
        {
            var builder = new ConfigurationBuilder()
                          .AddConfigurationFile("Email.json", optional: true, reloadOnChange: true);

            builder.Build();
            var cb = new ContainerBuilder();

            cb.AddEmail();
            IEmail mail = cb.Build().Resolve <IEmail>();

            Assert.IsNotNull(mail);
            mail.SendMailAsync("*****@*****.**", "单TO无CC", "测试邮件").Wait();
            mail.SendMailAsync("*****@*****.**", "*****@*****.**", "单TO单CC", "测试邮件").Wait();
            mail.SendMailAsync("*****@*****.**", "[email protected];[email protected]", "单TO多CC", "测试邮件").Wait();
            mail.SendMailAsync("[email protected];[email protected]", "多TO无CC", "测试邮件").Wait();
            mail.SendMailAsync("[email protected];[email protected]", "*****@*****.**", "多TO单CC", "测试邮件").Wait();
            mail.SendMailAsync("[email protected];[email protected]", "[email protected];[email protected]", "多TO多CC", "测试邮件").Wait();
        }