Example #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("1:gmail,2:163,3:hbu");
            try
            {
                Dimac.JMail.Message jM;
                Dimac.JMail.Smtp    smtp;
                switch (Console.ReadLine())
                {
                case "1":
                    Tools.SendMail.SendMailGmail("*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "test", Body());

                    break;

                case "2":
                    Tools.SendMail.SendMail163("*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "163" + DateTime.Now, Body());
                    break;

                case "3":
                    Tools.SendMail.SendMailhbu("*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "hbu" + DateTime.Now, Body());
                    break;

                case "4":
                    Tools.obMail.SenddMail("*****@*****.**", "*****@*****.**", "hbu" + DateTime.Now, Body());
                    break;

                case "5":
                    jM            = new Dimac.JMail.Message();
                    jM.From.Email = "*****@*****.**";
                    jM.To.Add(new Dimac.JMail.Address("*****@*****.**"));

                    jM.Subject  = "163Jmail" + DateTime.Now;
                    jM.BodyHtml = Body();
                    jM.Charset  = System.Text.UTF8Encoding.UTF8;

                    smtp                = new Dimac.JMail.Smtp();
                    smtp.HostName       = "smtp.163.com";
                    smtp.Authentication = Dimac.JMail.SmtpAuthentication.Login;
                    smtp.Domain         = "smtp.163.com";
                    smtp.UserName       = "******";
                    smtp.Password       = "******";
                    smtp.Send(jM);

                    break;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.InnerException);
                Console.WriteLine(ex.HelpLink);
                Console.WriteLine(ex.Source);
                Console.WriteLine(ex.TargetSite);
                Console.WriteLine(ex.StackTrace);
            }
            Console.WriteLine("success");
            Console.ReadLine();
        }
Example #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("1:gmail,2:163,3:hbu");
            try
            {
                Dimac.JMail.Message jM;
                Dimac.JMail.Smtp smtp;
                switch (Console.ReadLine())
                {
                    case "1":
                        Tools.SendMail.SendMailGmail("*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "test", Body());

                        break;
                    case "2":
                        Tools.SendMail.SendMail163("*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "163"+DateTime.Now, Body());
                        break;
                    case "3":
                        Tools.SendMail.SendMailhbu("*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "hbu"+DateTime.Now, Body());
                        break;
                    case "4":
                        Tools.obMail.SenddMail("*****@*****.**", "*****@*****.**", "hbu"+DateTime.Now, Body());
                        break;
                    case "5":
                        jM = new Dimac.JMail.Message();
                        jM.From.Email = "*****@*****.**";
                        jM.To.Add(new Dimac.JMail.Address("*****@*****.**"));

                        jM.Subject = "163Jmail"+DateTime.Now;
                        jM.BodyHtml = Body();
                        jM.Charset = System.Text.UTF8Encoding.UTF8;

                        smtp = new Dimac.JMail.Smtp();
                        smtp.HostName = "smtp.163.com";
                        smtp.Authentication = Dimac.JMail.SmtpAuthentication.Login;
                        smtp.Domain = "smtp.163.com";
                        smtp.UserName = "******";
                        smtp.Password = "******";
                        smtp.Send(jM);

                        break;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.InnerException);
                Console.WriteLine(ex.HelpLink);
                Console.WriteLine(ex.Source);
                Console.WriteLine(ex.TargetSite);
                Console.WriteLine(ex.StackTrace);
            }
            Console.WriteLine("success");
            Console.ReadLine();
        }