我正在学习C#网络编程,现在在研究怎样实现发送邮件的功能!
   研究了一段时间还是实现不了,请各位高手多多指教。

解决方案 »

  1.   

    http://blog.csdn.net/lff642/archive/2008/07/15/2654346.aspx
      

  2.   

      protected void Button1_Click(object sender, EventArgs e)
        {
            //创建一个新邮件
            jmail.MessageClass message = new MessageClass();
            //设置邮件的编码格式为中文
            message.Charset = "gb2312";
            //邮件的发送者
            message.From = txtsendmail.Text;
            //邮件的发送者显示的名字
            message.FromName = txtsendname.Text;
            //邮件的主题
            message.Subject = subject.Text;
            //邮件的内容
            message.Body = txtcontent.Text;
            //邮件服务器的验证名称和密码
            message.MailServerUserName = txtValidatename.Text;
            message.MailServerPassWord = txtValidatepass.Text;
            //添加附件
            //判断是否选择了文件
            if (FileUpload1.PostedFile.FileName != "")
            {
                //文件的路径
                string filepath = FileUpload1.PostedFile.FileName;
                //添加到邮件的附件中
                message.AddAttachment(filepath, true, "text/html");
            }
            //邮件的接收人
            message.AddRecipient(txtreceive.Text, "", "");
            //发送参数是邮件的服务器,不同邮件地址、服务器肯定不同
            message.Send(smtp.Text, false);
            //提示信息
            Response.Write("<script language='javascript'> alert('发送成功');</script>");    }
    }
      

  3.   


    这个都帖得不想帖了有W个人的博客里有这些东西了。。LZ自己搜一下。。
      

  4.   

    http://www.cnblogs.com/hymxtang/archive/2007/06/27/797247.html这个里面说的蛮多的,从基础的说起
      

  5.   

    http://blog.csdn.net/hb_gx/archive/2008/04/16/2298945.aspx//用 System.Web.Mail 的写法
    MailMessage mail = new MailMessage();
    mail.To = txtMailTo.Text; //收件人,多个收件人用 ; 号隔开,很是灵活
    mail.Subject = txtSubject.Text; //主题
    mail.Body = txtBody.Text;  //内容
    mail.BodyFormat = MailFormat.Html;
    mail.Priority = MailPriority.Normal;
    //显示的发件人
    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendemailaddress", "[email protected]");
    //实际发件人
    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpaccountname", "[email protected]");
    //用户名
    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "hbgx");
    //密码
    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "xgbh");
    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //验证级别SmtpMail.SmtpServer = "smtp.hotmail.com";
    SmtpMail.SmtpServer.Insert(0, "smtp.hotmail.com");
    SmtpMail.Send(mail);
    本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/hb_gx/archive/2008/04/16/2298945.aspx