我要写个方法,就是调用一个邮箱,把指定的文件发送到另一个邮箱,
就是用这个方法实现发邮件的,我是新学asp,希望大家给个思路,详细为好,谢谢!

解决方案 »

  1.   

    1. Import the namespace, and create instances of required classesWe are going to use the SmtpMail and MailMessage classes, which belong to the System.Web.Mail namespace. In order to use them, we will need to import the System.Web.Mail namespace like this:<%@ Import Namespace="System.Web.Mail" %>The MailMessage class provides properties and methods for constructing an email message. To build our email message we need to create an instance of this class:Dim objMail As New MailMessage()2. Set the properties of the objectNext, we have to set all the properties of the objMail object:' The email address of the sender 
    objMail.From = "[email protected]" ' The email address of the recipient 
    objMail.To = "[email protected]" ' The email address of the Cc recipient 
    objMail.Cc = "[email protected]" ' The email address of the Bcc recipient 
    objMail.Bcc = "[email protected]" ' The format of the message - it can be MailFormat.Text 
    or MailFormat.Html 
    objMail.BodyFormat = MailFormat.Text ' The priority of the message  - it can be MailPriority.High, 
    MailPriority,Normal or MailPriority.Low 
    objMail.Priority = MailPriority.High 'The subject of the message 
    objMail.Subject = "My first ASP.NET email" 'The message text 
    objMail.Body = "This is my first email sent via 
    ASP.NET. It was easier than I thought :)"After all the properties (some of them are optional) of our new email message are set properly, the only thing that's left to do is send the message. 3. Send the MessageIf you have experience sending email from classic ASP script with CDONTS you might think that the MailMessage class has method Send or something similar. Well, the way ASP.NET sends email messages is a little different from ASP. We need to use the static method Send of the SmtpMail class, passing in our objMail instance. You might be asking "what's a 'static method'?" A static method is one that's not associated with an instance of a type. An example of an instance of a type is our objMail object. It is illegal to reference a static member of a class through an instance. The proper way to do it is:SmtpMail.Send(objMail)If you want to specify an SMTP server that's different than the default, you'll need to set the SmtpServer property of the SmtpMail class:SmtpMail.SmtpServer = "smtp.your-server.com"
      

  2.   

    下一套邮件发送系统来看看吧,,,三言两语谁说的清楚
    上google一搜一大堆
    http://www.mycodes.net/soft/10393.htm
    http://www.onlinedown.net/soft/30337.htm
      

  3.   

                   string MT= "[email protected]";
    string MS = "nihao";
    string MB = "body";
        Sendmail(MT,MS,MB);
    private void Sendmail(string MessageTo, string MessageSubject, string MessageBody)
    {
        MailMessage message = new MailMessage();
    message.From = "[email protected]";
    message.To = MessageTo;
    message.Subject = MessageSubject;
    message.BodyFormat = MailFormat.Text;
    message.Priority = MailPriority.High; //优先级
    message.Body = MessageBody;
    SmtpMail.SmtpServer = "";
    SmtpMail.Send(message);
                    }
    我这个运行没错误,但是也发不了,有什么问题吗