出错:未将对象引用设置到对象的实例。jmail.POP3Class  PopMail = new jmail.POP3Class();
PopMail.Connect("xiaoxingchi123","123456zxc","pop3.163.com",110); TextBox1.Text = PopMail.Count.ToString();
int n;
n = PopMail.Count;
for(int i=1;i<=n;i++)
{
Mail.ContentTransferEncoding="base64";
Mail.Encoding="base64";
Mail.Charset="GB2312";
Response.Write("主题:" + Mail.Subject[i] + "<br/>");
}

解决方案 »

  1.   

    出错在这一行。
    Response.Write("主题:" + Mail.Subject[i] + "<br/>");
      

  2.   

    未将对象引用设置到对象的实例。 
    说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。源错误: 
    行 37:  Mail.Encoding="base64";
    行 38:  Mail.Charset="GB2312";
    行 39:  Response.Write("主题:" + Mail.Subject[i] + "<br/>");
    行 40:  }
    行 41: 
     源文件: f:\web\popmail\webform1.aspx.cs    行: 39 堆栈跟踪: 
    [NullReferenceException: 未将对象引用设置到对象的实例。]
       PopMail.WebForm1.Page_Load(Object sender, EventArgs e) in f:\web\popmail\webform1.aspx.cs:39
       System.Web.UI.Control.OnLoad(EventArgs e)
       System.Web.UI.Control.LoadRecursive()
       System.Web.UI.Page.ProcessRequestMain() 
      

  3.   

    我这里有一个示例http://www.1jq.net/sample/JmailSend.aspx源码在http://www.1jq.net/sample/src/src.rar