由于积分限制 只能先发100分了

解决方案 »

  1.   

    http://blog.csdn.net/goody9807/articles/30560.aspx
      

  2.   

    MailMessage Mailer = new MailMessage();
    Mailer.From = "服务器域名";
    Mailer.To = "发送的邮箱";
    Mailer.Subject = "邮件名";
    Mailer.Body = "邮件内容";
    Mailer.BodyFormat = System.Web.Mail.MailFormat.Text;
    SmtpMail.SmtpServer ="邮件服务器地址";
    SmtpMail.Send(Mailer);
    Label1.Text = "密码已经成功发送到你的邮箱中!";   //页面提示
      

  3.   

    Imports System.Web.Mail
                Dim mymail As New Mail.MailMessage
                mymail.From =  
                mymail.To = 
                mymail.Subject = "biao ti"
                mymail.Body = "nei rong"
                Mail.SmtpMail.SmtpServer =  "fu wu qi di zhi"
                Mail.SmtpMail.Send(mymail)
      

  4.   

    使用CDO发送(Microsoft CDO)
    namespace GoldWeb.WebUI
    {
    using System;
    using System.Text;
    using CDO;
    using GoldWeb.Model;
    using GoldWeb.SystemFramework; /// <summary>
    /// CDO Email操作类
    /// </summary>
    public class CdoMail
    {
    /// <summary>
    /// 构造函数
    /// </summary>
    public CdoMail()
    {
    } public static int Send(AccountModel accountModel)
    {
    try
    {
    string email = ApplicationString.HtmlEncodeString(accountModel.Email);
    string userName = ApplicationString.HtmlEncodeString(accountModel.UserName);
    string password = ApplicationString.HtmlEncodeString(accountModel.Password); Message oMsg = new MessageClass();
    oMsg.From = ""; // 邮件来源
    oMsg.To = email;
    oMsg.Subject = "确认函"; StringBuilder sb = new StringBuilder();
    sb.Append("你的邮件内容");
    oMsg.HTMLBody = sb.ToString();
    IConfiguration iConfg = oMsg.Configuration;
    ADODB.Fields oFields = iConfg.Fields; oFields["http://schemas.microsoft.com/cdo/configuration/sendusing"].Value = 2;
    oFields["http://schemas.microsoft.com/cdo/configuration/sendemailaddress"].Value = email; //sender mail
    oFields["http://schemas.microsoft.com/cdo/configuration/smtpaccountname"].Value = "[email protected]"; //email account
    oFields["http://schemas.microsoft.com/cdo/configuration/sendusername"].Value = ""; // 邮箱用户名
    oFields["http://schemas.microsoft.com/cdo/configuration/sendpassword"].Value = ""; // 邮箱密码
    oFields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"].Value = 1;
    //value=0 代表Anonymous验证方式(不需要验证)
    //value=1 代表Basic验证方式(使用basic (clear-text) authentication. 
    //The configuration sendusername/sendpassword or postusername/postpassword fields are used to specify credentials.)
    //Value=2 代表NTLM验证方式(Secure Password Authentication in Microsoft Outlook Express)
    oFields["http://schemas.microsoft.com/cdo/configuration/languagecode"].Value = 0x0804;
    oFields["http://schemas.microsoft.com/cdo/configuration/smtpserver"].Value = ""; // 邮件服务器地址 oFields.Update();
    oMsg.BodyPart.Charset="gb2312";
    oMsg.HTMLBodyPart.Charset="gb2312";  oMsg.Send();
    oMsg = null;

    return 0;
    }
    catch
    {
    return 1;
    }
    }
      

  5.   

    aokon(傲空)
    MailMessage Mailer = new MailMessage();
    Mailer.From = "服务器域名";
    Mailer.To = "发送的邮箱";
    Mailer.Subject = "邮件名";
    Mailer.Body = "邮件内容";
    Mailer.BodyFormat = System.Web.Mail.MailFormat.Text;
    SmtpMail.SmtpServer ="邮件服务器地址";
    SmtpMail.Send(Mailer);
    Label1.Text = "密码已经成功发送到你的邮箱中!";   //页面提示=============报错
    The transport failed to connect to the server. 
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: The transport failed to connect to the server. Source Error: 
    Line 52:         Mailer.BodyFormat = System.Web.Mail.MailFormat.Text
    Line 53:         SmtpMail.SmtpServer = "smtp.163.com"
    Line 54:         SmtpMail.Send(Mailer) 
      

  6.   

    OpenSMTP.NET 支持SMTP 認證 收信OpenPop.NET开源的,既可以使用组件,也可以只直接利用源码,很酷的,我已放弃jmail了,jmail尽管强大,但需要服务器支持,比较罗嗦
    以下来自http://www.neo.com.tw/archives/000244.htmlVB.Net 的使用範列: (修改自官方說明的 C# 範例)Imports OpenSmtp.Mail '在 Visual Studio 記得要引用「專案->加入參考->opensmtp.dll」Dim from As New EmailAddress("[email protected]", "Neo")
    Dim sto As New EmailAddress("[email protected]", "XYZ")
    Dim msg As New OpenSmtp.Mail.MailMessage(from, sto)
    msg.Subject = "測試 OpenSmtp .Net SMTP component"
    msg.Body = "Neo's BLOG 測試"
    msg.Charset = "big5" '這個很重要,一定要設成 big5 或 UTF-8 才能正常顯示中文msg.AddAttachment("c:\reply\test.gif")
    Dim Smtp As New Smtp("www.xxx.com.tw", 25)
    Smtp.Username = "neo" '有支援 SMTP 認證
    Smtp.Password = "xyz"
    Smtp.SendMail(msg) 
      

  7.   

    Imports OpenSmtp.Mail
    Imports System.IO.Path
    Public Class TestOpenSmtp
        Inherits System.Web.UI.Page#Region " Web 窗体设计器生成的代码 "    '该调用是 Web 窗体设计器所必需的。
        <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()    End Sub
        Protected WithEvents ToEmail As System.Web.UI.WebControls.TextBox
        Protected WithEvents send As System.Web.UI.WebControls.Button
        Protected WithEvents CarbonCopy As System.Web.UI.WebControls.TextBox
        Protected WithEvents Attachment0 As System.Web.UI.HtmlControls.HtmlInputFile
        Protected WithEvents Subject0 As System.Web.UI.WebControls.TextBox
        Protected WithEvents body0 As System.Web.UI.WebControls.TextBox
        Protected WithEvents Label1 As System.Web.UI.WebControls.Label
        Protected WithEvents BCC0 As System.Web.UI.WebControls.TextBox
        Protected WithEvents HTML As System.Web.UI.WebControls.CheckBox
        Protected WithEvents File1 As System.Web.UI.HtmlControls.HtmlInputFile
        Protected WithEvents Attachment1 As System.Web.UI.HtmlControls.HtmlInputFile    '注意: 以下占位符声明是 Web 窗体设计器所必需的。
        '不要删除或移动它。
        Private designerPlaceholderDeclaration As System.Object    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
            'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
            '不要使用代码编辑器修改它。
            InitializeComponent()
        End Sub#End Region    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            '在此处放置初始化页的用户代码
        End Sub    Private Sub send_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles send.Click
            Dim msg As New OpenSmtp.Mail.MailMessage("[email protected]", ToEmail.Text.Trim)
            msg.Subject = Subject0.Text.Trim
            If HTML.Checked Then
                msg.HtmlBody = body0.Text.Trim
            Else
                msg.Body = body0.Text.Trim
            End If        msg.CC.Add(New OpenSmtp.Mail.EmailAddress(CarbonCopy.Text.Trim))
            msg.BCC.Add(New OpenSmtp.Mail.EmailAddress(BCC0.Text.Trim))
            msg.Charset = "gb2312" ' "UTF-8" ' "gb2312" ' "big5" jronline BCC0
            Dim a As New Attachment(Attachment0.PostedFile.InputStream, GetFileName(Attachment0.PostedFile.FileName()))
            Label1.Text = GetFileName(Attachment0.PostedFile.FileName())
            msg.AddAttachment(a)
            a = New Attachment(Attachment1.PostedFile.InputStream, GetFileName(Attachment1.PostedFile.FileName()))
            msg.AddAttachment(a)
            Dim Smtp As New Smtp("SMTP.163.com", 25)
            ' SmtpConfig.VerifyAddresses = False
            Smtp.Username = "mingchao" 'smtp服务器需要验证时填写这两项,否则不填写,填写了反而出错
           Smtp.Password = "mingchao
            Smtp.SendMail(msg)
            Page.Response.Write("<script language=javascript>alert(""发送完毕!"");</script>")
        End Sub
    End Class
      

  8.   

    <%@ Page Language="vb" validateRequest=false AutoEventWireup="false" Codebehind="TestOpenSmtp.aspx.vb" Inherits="WebTest.TestOpenSmtp"  %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <title>TestOpenSmtp</title>
    <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
    <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
    <meta content="JavaScript" name="vs_defaultClientScript">
    <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    </HEAD>
    <body>
    <form id="Form1" method="post" runat="server">
    <TABLE style="WIDTH: 632px; HEIGHT: 252px" align="center">
    <tr>
    <td style="WIDTH: 187px">
    <P align="center"><FONT face="宋体">收信人信箱</FONT></P>
    </td>
    <td><asp:textbox id="ToEmail" runat="server" Width="439px"></asp:textbox></td>
    </tr>
    <tr>
    <td style="WIDTH: 187px">
    <P align="center">抄 送 信箱</P>
    </td>
    <td><asp:textbox id="CarbonCopy" runat="server" Width="439px"></asp:textbox></td>
    </tr>
    <TR>
    <TD style="WIDTH: 187px">
    <P align="center">密&nbsp;送 信箱</P>
    </TD>
    <TD><asp:textbox id="BCC0" runat="server" Width="439px"></asp:textbox></TD>
    </TR>
    <tr>
    <td style="WIDTH: 187px; HEIGHT: 27px">
    <P align="center"><FONT face="宋体">信 件 标题</FONT></P>
    </td>
    <td style="HEIGHT: 27px"><asp:textbox id="Subject0" runat="server" Width="439px"></asp:textbox></td>
    </tr>
    <tr>
    <td style="WIDTH: 187px; HEIGHT: 183px">
    <P align="center"><FONT face="宋体">信 件 </FONT>正 文</P>
    <P align="center"><asp:checkbox id="HTML" runat="server" Text="是否为Html文件"></asp:checkbox></P>
    </td>
    <td style="HEIGHT: 183px"><asp:textbox id="body0" runat="server" Width="439px" Height="190px" TextMode="MultiLine"></asp:textbox></td>
    </tr>
    <tr>
    <td style="WIDTH: 187px">
    <P align="center"><FONT face="宋体"><FONT face="宋体">随 信 </FONT>附 件</FONT></P>
    </td>
    <td><INPUT id="Attachment0" style="WIDTH: 432px; HEIGHT: 22px" type="file" size="52" name="File1"
    runat="server">
    </td>
    </tr>
    <TR>
    <TD style="WIDTH: 187px"></TD>
    <TD><INPUT id="Attachment1" style="WIDTH: 432px; HEIGHT: 22px" type="file" size="52" name="File1"
    runat="server"></TD>
    </TR>
    <TR>
    <TD style="WIDTH: 187px"></TD>
    <TD align="right"><asp:button id="send" runat="server" Text="发 送"></asp:button></TD>
    </TR>
    </TABLE>
    <asp:label id="Label1" runat="server" Width="640px">Label</asp:label></form>
    </body>
    </HTML>
      

  9.   

    public string SendPassword()
      {
       jmail.Message MailObj=new jmail.MessageClass();
       MailObj.From="xxxx@163com";  //发件人的地址
       MailObj.Logging=true;
       MailObj.MailServerUserName="xxxx";   //发件人用户名
       MailObj.MailServerPassWord="xxxxxxxx"; //服务器验证
       MailObj.HTMLBody=" Hello,欢迎查看此贴,^_^:";
       MailObj.Charset="gb2312";
       MailObj.Subject="HELLO";
       MailObj.FromName="Hey";
       MailObj.AddRecipient([email protected],"User","A");  //添加接收人
       MailObj.Priority=3;
       
       //发送   if(MailObj.Send("smtp.163.com",false))
       {
        return "Success";
       }
       else
       {
        return "Fail";
        
       }
      

  10.   

    用这个吧,一定可以啊
     在开发电子邮件发送程序的时候,我们经常需要使用到相应的组件,其实不需要第三方的组件(例如:Jmail)照常可以做到发送Email的功能。      在系统目录(如c:\winnt或c:\windows)的system32子目录中可以找到一个名称为cdosys.dll的文件,我们可以通过ASP.NET调用此COM组件来实现Email的发送。cdosys构建在SMTP协议和NNTP协议之上,并且作为Windows2000 Server的组件被安装,当然我们也可以使用Exchange2000中cdoex.dll来实现发送邮件的机制。由于cdosys.dll自动内嵌到了操作系统中,所以不用再去注册相应的其他发送程序,下面我们来做一个发送实例。    1、新建一个项目文件    2、添加引用系统目录下的cdosys.dll文件,在引用中会发现添加了两个要用到的接口:CDO,ADODB    3、添加新项文件SendMail.aspx,在其页面上放置三个Label,三个Textbox,作用分别为收件人地址、主题、内容,放置一个Button按钮。    4、切换到代码页,创建一下内容  public void CDOsendmail()
      {
       try
       {
        CDO.Message Msg = new CDO.Message();
        Msg.From = "[email protected]";
        Msg.To = this.TextBox1.Text.Trim();
        Msg.Subject = this.TextBox2.Text.Trim();
        Msg.HTMLBody = "<html><body>"+this.TextBox3.Text
    +"</body></html>";
        CDO.IConfiguration Config = Msg.Configuration;
        ADODB.Fields oFields = Config.Fields;
        oFields["http://schemas.microsoft.com/cdo/configuration/sendusing"].Value = 2;
        oFields["http://schemas.microsoft.com/cdo/configuration/sendusername"].Value="rattlesnake";
        oFields["http://schemas.microsoft.com/cdo/configuration/sendpassword"].Value="pass"; 
        oFields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"].Value=1;
        oFields["http://schemas.microsoft.com/cdo/configuration/languagecode"].Value=0x0804;
        oFields["http://schemas.microsoft.com/cdo/configuration/smtpserver"].Value="smtp.263.net";
        oFields.Update();    Msg.BodyPart.Charset = "gb2312";
        Msg.HTMLBodyPart.Charset = "gb2312";
        Msg.Send();
        Msg = null;
       }
       catch(Exception err)
       {
           throw err;
       }
      }    5、为Button添加Click事件  private void Button1_Click(object sender, System.EventArgs e)
      {
          this.CDOsendmail();
      }
            运行程序,然后检查邮箱即可。
      

  11.   

    http://www.cndevx.com/Article/ShowArticle.asp?ArticleID=1899
      

  12.   

    cyy1981() 
    报错
    The message could not be sent to the SMTP server. The transport error code was 0x800ccc15. The server response was not available 
      

  13.   

    请问 jmail 这个组件 在哪可以得到啊式了几种方法都不行啊
      

  14.   

    cdo 也是构建在SMTP协议和NNTP协议之上
    那我要没装smtp服务可以吗
      

  15.   

    没装也可以
    oFields["http://schemas.microsoft.com/cdo/configuration/smtpserver"].Value="smtp.263.net";
    oFields["http://schemas.microsoft.com/cdo/configuration/sendusername"].Value="rattlesnake";
        oFields["http://schemas.microsoft.com/cdo/configuration/sendpassword"].Value="pass"; 
    这3个要写对
      

  16.   

    to  raingod(皆大欢喜) ,给我发个短信留下你的邮箱,我给你发个jmail pro正式版的!
      

  17.   

    cyy1981() 
    我拷贝你的 代码 应该 不会错吧
      

  18.   

    oFields["http://schemas.microsoft.com/cdo/configuration/smtpserver"].Value="smtp.263.net";
    oFields["http://schemas.microsoft.com/cdo/configuration/sendusername"].Value="rattlesnake";
        oFields["http://schemas.microsoft.com/cdo/configuration/sendpassword"].Value="pass"; 
    这三个你写对了吗?比如我用的是163的邮箱[email protected]。第一个是你自己申请邮箱的服务起地址 ,应该写smtp.163.com,第二项写你的邮箱名称123,第3个是邮箱的密码
    你是这样写的吗?