<% @Language=vbscript %>
<%
option explicit
dim  objMail
Set objMail = Server.CreateObject("CDONTS.NewMail")objMail.From ="[email protected]"
objMail.To = "[email protected]"   
objMail.Subject ="测试"  
objMail.body = "请看附件"
objMail.attachurl server.mappath("zm.gif")objMail.Send
Set objMail = Nothing
response.write "邮件发送成功"
%>

解决方案 »

  1.   

    这样是利用客户端的CDO的发送邮件,我想利用服务器端发送,不过这也不失为一种解决方法,anyway,谢谢你的回答!
      

  2.   

    http://www.gotdotnet.com/userarea/default.aspx
      

  3.   

    全部原码提供估计很难!不知道为什么。ASP.NET的全原码很少很少!!都在想发财吧!!呵呵!!
      

  4.   

    see
    Sending Email with ASP.NET
    http://www.aspheute.com/english/20000918.aspSend an HTML E-Mail with Attachment through SMTP Server  
    http://www.dotnetextreme.com/code/htmlmail.asp
      

  5.   

    to:思归
    http://www.dotnetextreme.com/code/htmlmail.aspusing System;
    using System.Web.Mail;class HTMLMail
    {
        public static void Main() 
        { 
            Console.WriteLine("Sending Mail"); 
            try 
            { 
                MailMessage oMail = new MailMessage(); 
                Console.WriteLine("Mail Created"); 
                oMail.To = "[email protected]"; 
                oMail.Cc = "[email protected]"; 
                oMail.From = "[email protected]"; 
                oMail.Subject = "Hi Yateen"; 
                oMail.BodyFormat = MailFormat.Html; 
                string strBody = "<b>Hello <i>Yateen</i></b>" + 
                                       " This is from <font color=red>.NET</font>"; 
                oMail.Body = strBody;
                SmtpMail.Send(oMail); 
                Console.WriteLine("Mail Sent"); 
            } 
            catch(Exception ex)
           { 
               Console.WriteLine("Error : " + ex.Message); 
            }
         } 
    }
     
    We create a Mail object and set the appropriate mail properties like To, From,CC, Subject, Body and then set the BodyFormat property of the mail object to HTML.Let's see how do we add an attachment to the above mail. Add the command given below just before we send the mail with the statement Smtp.Send .oMail.Attachments.Add(new MailAttachment("c:\\aishwarya1.jpg"));We need to add "\" twice since it is an escape character.Compile the above code using the following commandcsc /r:System.Web.dll HTMLMail.csYou can run the console.exe from command prompt to send the mail. Happy Coding !!!!
     
     
    这里只是简单地调用system.web的MailMessage()类,但是此类并不适用现在普遍存在的要求验证的SMTP服务器
      

  6.   

    到现在为止, cnuninet() 的方案我认为最佳,如果大家无异议,200分就都给他了....SmtpClient component is written in 100% managed C# code, it does *NOT* rely on System.Web.Mail which uses CDONTS. 
    Addheres RFC 821/1521/2554/2821 compliance. 
    Features: 
    html/text messages, multiple recipients, multiple attachments, multiple servers, connection retries, MIME encoding, custom headers, message priority, 
    authentication, message serialization/deserialization, supports all character sets and more! 
    Includes it's source code. 
    UPDATE: All reported && known bugs have been fixed. Sample Type: CLR
    .NET Version: 1.0
    Experience Level: Advanced
    Dependencies:
      

  7.   

    快给分吧。:)不过为了学习那家伙的代码还需要看完rfc smtp的文档,我头都大了。