Import Namespace System.ASP.Util        Dim myMessage   As New MailMessage
        Dim myMail      As New SmtpMail        myMessage.From = "[email protected]"    
        myMessage.To = "[email protected]"    
        myMessage.Subject = "Great News"    
        myMessage.Body = ".NET rocks"    
    
        myMail.Send (myMessage)
        End Subor
System.Web.Util.SmtpMail.Send(fromemail, toemail, subject, body);

解决方案 »

  1.   

    using System.Web.Mail;
    MailMessage mailObj AS new MailMessage();
    mailObj.From = "...";
    mailObj.To = "...";
    mailObj.Subject = "...";
    mailObj.Body = "...";
    SmtpMail.Send(mailObj);
      

  2.   

    这样怎么没有收到阿?
    我SMTP开了,是不是还要设置什么东东阿?
      

  3.   

    Two method
    1. Use CDONTS.DLL
       first reference the cdonts.dll in the winnt\system32
       CDONTS.NewMail newMail = new CDONTS.NewMail();
       newMail.BodyFormat = 0; //CdoBodyFormatHTML
       newMail.MailFormat = 0; //CdoMailFormatMime
       newMail.Send("[email protected]","[email protected]", "Hello","Test", 1); //CdoNormal Priority2. Use STMP.Send
    Reference System.Web
    using System.Web.Mail;
    System.Web.Mail.SmtpMail.SmtpServer="stmp.abc.com";
    System.Web.Mail.SmtpMail.Send(strFrom,strTo,strTitle,strBody);if you donot set SmtpServer property, the mail will be queued on local machine.
      

  4.   

    用本地SMTP服务发信会有延迟的,不是马上能收到的。