Ejemplo n.º 1
0
        private static void PasswordCipher()
        {
            string ciphertext = EncryptionControll.EncipherRSA("123456");

            //string ciphertext = "TBnKLD+hRCP3K3cist5iJEj8DCXJc02hKT7U5zvYDFaU2o5BkK00GJqoSJ72iqNZeCEEZ4CE2u8UBJ243JEolZgC4aRsIxLoTz+ngTqMkOeUOlJELlAoUhLz0piW2Le+D7VEJBot4MW/8vdnXoQDEAljAxcWE7l6rDgYiTCydN8=";
            ciphertext = EncryptionControll.DecipherRSA(ciphertext);
        }
Ejemplo n.º 2
0
        private static void SendEmail()
        {
            string ciphertext = "Ll8OtEc/+uh5wySpAkur6e7MQ/ZtdbFNY8xsUu/7fY3if11Yuy6wH0Veg5MZJL5T6b1hFDKX0w+uSzGYkU0r/w2dG+hsNKaGaVufoCis9s38RNkShrmGCrz+8Se2pBw/Wh6Q3rf53S2bhYKS915fcRHR94LeM9kLMCglLHg/iN4=";
            string style      = "<span style='color:red;font-size:36px; '>{0}</span>";
            //style = "<p style=\"font-size: 10pt\">{0} 以下内容为系统自动发送,请勿直接回复,谢谢。</p><table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" bgcolor=\"000000\" style=\"font-size: 10pt;line-height: 15px;\">";
            var h1 = new ConfigHost()
            {
                Server    = "smtp.163.com",
                Port      = 25,
                Username  = "******",
                Password  = EncryptionControll.DecipherRSA(ciphertext),
                EnableSsl = false
            };
            var m1 = new ConfigMail()
            {
                Subject = "Test",
                Body    = string.Format(style, "你好!"),
                From    = "*****@*****.**",
                To      = new string[] { "*****@*****.**" },
            };

            var agents = new List <IEMailBase>()
            {
                new EMailBase()
            };

            foreach (var agent in agents)
            {
                var output = "Send m1 via h1 " + agent.GetType().Name + " ";
                Console.WriteLine(output + "start");
                try
                {
                    agent.CreateHost(h1);
                    m1.Subject = output;
                    agent.CreateMail(m1);
                    agent.SendMail();
                    Console.WriteLine(output + "success");
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
                Console.WriteLine(output + "end");
                Console.WriteLine("-----------------------------------");
            }
            Console.Read();
        }