当前位置:编程学习 > C#/ASP.NET >>

0x80040217 这个错误如何解决,解决后马上给分!!!急急急!!!!

同样的代码,在另外一台机器上就能发送出去,在本机就不能成功,错误全称为:The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available 

我用的环境 win2000,vs2005.net,c# --------------------编程问答-------------------- 感觉上是本机的哪里的配置问题,请各位高手帮忙!! --------------------编程问答-------------------- 不太清楚,mark准备学习 --------------------编程问答-------------------- 首先你得保证你这台机器能发送邮件,不防先试试微软的outlook,如果他不能收发,那你的程序肯定也不能了,看看我以前的一篇文章http://blog.csdn.net/catvi/archive/2006/12/06/1431960.aspx --------------------编程问答-------------------- 以前也碰到过,一直没解决.期待...... --------------------编程问答-------------------- 页面权限的问题吧
点击属性看看设置的权限 --------------------编程问答-------------------- 楼上的,应该不是.代码在服务器可以发,在本地就不能发了.其实说到底还是里面机制一点都不明白.当时只知道那么copy代码.哎 --------------------编程问答-------------------- 绝不让帖子沉下去 --------------------编程问答-------------------- 帮顶一下。
邮件服务器测试没有问题再找代码的问题。 --------------------编程问答-------------------- 但是我用的是DreamMail一样的可以收发邮件,照你上面的代码那样写的还是不能发出去会出现


邮件无法发送到 SMTP 服务器。传输错误代码为 0x80040217。服务器响应为 not available


的错误。请帮我看下怎么回事。我把我的代码发上来请你你帮我看下怎么回事 谢谢。





MailMessage objMailMessage = new MailMessage();
        objMailMessage.To = "604258727@163.com";
        objMailMessage.From = "60425872@qq.com";
        objMailMessage.Subject = "this is a test mail";
        objMailMessage.Body = "you can try to send mail to me";
        objMailMessage.BodyFormat = MailFormat.Html;
        objMailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
        //设置验证用户名(把my_username_here改为你的验证用户名)   
        objMailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername ", "604258727");
        objMailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "password");
        SmtpMail.SmtpServer = "220.181.12.16";
        SmtpMail.Send(objMailMessage); --------------------编程问答-------------------- 0x80040217. The server response was not available
检查你的邮箱的pop/smtp服务是否开启。
具体路径:邮箱设置->账户->POP/SMTP设置->开启

--------------------编程问答-------------------- 顺便看看这个吧 --------------------编程问答-------------------- 有关通讯的 学习 --------------------编程问答--------------------   可以发送了 给你Code
  公布出来学习 --------------------编程问答--------------------

 internal class temp : ICredentialsByHost
    {
        public NetworkCredential GetCredential(string host, int port, string authenticationType)
        {
            return new NetworkCredential("You mail_Address", "You Password");
        }
    }

    protected void btnSend_Click(object sender, EventArgs e)
    {
        MailMessage mail = new MailMessage("604258727@qq.com", txtToMail.Text);
        try
        {
            mail.Subject = txtTitle.Text;
            mail.Body = txtContent.Text;
            SmtpClient smtp = new SmtpClient("smtp.qq.com");
            smtp.Credentials = new temp();
            smtp.Send(mail);
            Response.Write("邮件已发送!"); 
        }
        catch (Exception)
        {
            Response.Write("发送失败");
            throw;
        }
        
    }



经过测试完全可以实现发送 --------------------编程问答--------------------  还有 你的IIS 必须要安装SMTP服务才行要不然就算你代码写对的   还是由于协议的问题不能发送邮件 --------------------编程问答-------------------- Mark 学习 --------------------编程问答-------------------- 本机相关服务是不是关闭了? --------------------编程问答-------------------- 登陆权限
可能那台机器成功登陆了
而本机没有登陆过
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,