现需要一发送邮件的程序,需要做验证的,用MAILMESSAGE的似乎没有用!!
  各位高手有没有CDO,或者其他的源码一览!

解决方案 »

  1.   

    用SmtpMail类,然后设定SmtpServer就可以了
    具体例子请参看MSDN
      

  2.   

    SmtpMail.SmtpServer="mail.XX-org.com";
    MailMessage oMessage = new MailMessage();
    oMessage.From = "[email protected]";
    本地机 就是这么成功发送的,可到了服务器上就说什么没有连到嗣服器
      

  3.   

    <%@ Import NameSpace="System.Web.Mail" %><script runat="SERVER">
    Dim errorinfo As String
    Dim title As String
    Dim content As String
    Dim email As MailMessage
    </script><%
    '----------------------------------------------|数据检查|
    title = Server.HtmlEnCode(Trim(Request("sendtitles")))
    content = Server.HtmlEnCode(Trim(Request("sendcontents")))If title="" Then errorinfo = "无效访问"
    If content="" Then errorinfo = "无效访问"If Request.ServerVariables("REQUEST_METHOD") = "GET" Then errorinfo = "无效访问"If Len(Session("sendtime"))>0 Then
    If DateDiff("m",Now(),Session("sendtime")) < 5 Then
    Response.Write("<script>alert('您已刚发送完毕信件,请稍后再发!')</script>")
    Response.End()
    End If
    End IfIf errorinfo<>"" Then 
    Response.Write("<script>alert('" & errorinfo & "')</script>")
    Response.End()
    Else
    '----------------------------------------------|发送信件|
    email = New MailMessage()
    email.From = "[email protected]"
    email.To = "[email protected]"
    email.Subject = title
    email.BodyFormat = MailFormat.Text
    email.Body = content
    SmtpMail.SmtpServer = "61.1.1.1"
    'Try
    SmtpMail.Send(email)
    Session("sendtime") = Now()
    'Response.Write("<script>alert('信件已发送到局长信箱!')</script>")
    'Catch e As Exception
    'Response.Write("<script>alert('发送信件失败!请稍后再试')</script>")
    'response.write(e.tostring)
    'End Try
    email = Nothing
    End If
    %>
      

  4.   

    objMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1")        '基本验证
        objMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "jjshang99")    '用户名
        objMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "123456")        '密码为什么我验证后还是发送不了邮件,说什么没有连到嗣服器
      

  5.   

    SmtpMail.SmtpServer="mail.XX-org.com";
    MailMessage oMessage = new MailMessage();
    oMessage.From = "[email protected]";
    本地机 就是这么成功发送的,可到了服务器上就说什么没有连到嗣服器防火墙也关了objMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1")        '基本验证
        objMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "jjshang99")    '用户名
        objMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "123456")        '密码为什么我验证后还是发送不了邮件,说什么没有连到嗣服器