1.  .net2005里怎么实现发邮件
2.  .net2005里怎么实现ip消息这个发邮件的方法时出  "无法从传输连接中读取数据: net_io_connectionclosed。"错误
    public static void SendSMTPEMail(string strSmtpServer, string strFrom, string strFromPass, string strto, string strSubject, string strBody)
    {
        System.Net.Mail.SmtpClient client = new SmtpClient(strSmtpServer);
        client.UseDefaultCredentials = false;
        client.Credentials = new System.Net.NetworkCredential(strFrom, strFromPass);
        client.DeliveryMethod = SmtpDeliveryMethod.Network;
        client.Host = "127.0.0.1";
        System.Net.Mail.MailMessage message = new MailMessage(strFrom, strto, strSubject, strBody);
        message.BodyEncoding = System.Text.Encoding.UTF8;
        message.IsBodyHtml = true;        client.Send(message);
    }

解决方案 »

  1.   

    怎么都喜欢用.NET.MAIL
    WEB下用SYSTEM.WEB.MAIL        Sub SendMail(ByVal mailto As String)
                Dim mailObj As New System.web.Mail.MailMessage            With mailObj
                    .From = "EMAIL地址"
                    .To = mailto地址
                    .Subject = "主题"
                    .Body = "正文"
                    .BodyFormat = Mail.MailFormat.Html
                    .Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1")
                    .Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "用户名")
                    .Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "密码")
                End With            Dim send As System.Web.Mail.SmtpMail
                send.SmtpServer = "SMTP服务器"
                Try
                    send.Send(mailObj)
                Catch ex As Exception
                    response.write(ex.Message.ToString)
                End Try        End Sub
    主要是有验证的服务器一定要加这三个
    .Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1")
                    .Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "用户名")
                    .Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "密码")