简体   繁体   English

无法通过IIS服务器发送电子邮件(在本地工作)

[英]Not able to send E-mail through IIS server (Working in local )

I've been working on this from months, please someone help me solve this. 我已经工作了几个月,请有人帮我解决这个问题。 Thanks 谢谢

 try
        {
            SmtpClient smtpServer = new SmtpClient();
            MailMessage mail = new MailMessage();
            smtpServer.Credentials = new System.Net.NetworkCredential("iejabdb@otlook.com", "throughput");
            smtpServer.Port = 25;
            smtpServer.Host = "*****";
            smtpServer.EnableSsl = true;
            smtpServer.UseDefaultCredentials = true;
            mail.From = new MailAddress("*****@outlook.com", "Work Order System");
            mail.To.Add("*******@outlook.com");
            // mail.To.Add(receiptsArray.ToString());
            mail.Subject = "Test";
            mail.Body = "Hello";
            smtpServer.Send(mail);
        }

Test this Code: 测试此代码:

        MailMessage mail = new MailMessage();
        SmtpClient SmtpServer = new SmtpClient("smtp.live.com");

        mail.From = new MailAddress("mawlud.f.m@hotmail.com");
        mail.To.Add("mawlud.f.m@gmail.com");

        mail.Subject = "Mail Subject";
        mail.Body = "Mail Body";

        SmtpServer.Port = 587;
        SmtpServer.Credentials = new System.Net.NetworkCredential("mawlud.f.m@hotmail.com", "Write Your Password");

        SmtpServer.EnableSsl = true;
        SmtpServer.Send(mail);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM