.NET1.1
在.NET1.1中发送EMail主要有以下几种方式:
1)使用SMTP类(using System.Web.Mail)
2)使用CDO组件
3)使用Socket编写邮件发送程序
4)使用第三方组件如JMail
前三种在《在.NET中使用SMTP发送邮件》中已经作了详细介绍,可以参考。
使用JMail需要注册该组件,可参考相关资料。
下面是简单应用SMTP的例子,可做参考:

Code
public void SendSMTPEMail(string smtpServer, string serverPort,
string mailFrom, string mailPassword,
string mailTo, string mailBcc, string mailCc,
string mailSubject, string mailBody,
string mailAttachment)
{
System.Web.Mail.MailMessage mail = new System.Web.Mail.MailMessage();
mail.BodyFormat = MailFormat.Html;
mail.Priority = MailPriority.High;
mail.From = mailFrom;
mail.To = mailTo; //多个收件人之间用分号分割
mail.Bcc = mailBcc;
mail.Cc = mailCc;
mail.Subject = mailSubject;
mail.Body = mailBody;
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", mailFrom);
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", mailPassword);
//mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", serverPort);
//mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "1");
if(mailAttachment != null && mailAttachment.Trim() != "")
{
System.Web.Mail.MailAttachment attachment = new System.Web.Mail.MailAttachment(mailAttachment);
mail.Attachments.Add(attachment);
}
SmtpMail.SmtpServer = smtpServer;
SmtpMail.Send(mail);
}
NET2.0
在.NET1.1中发送EMail可以使用SMTP类(using System.Net.Mail)

Code
public void SendSMTPEMail(string strSmtpServer, string strFrom, string strFromPass, string strto, string strSubject, string strBody)
{
System.Net.Mail.SmtpClient client = new SmtpClient(strSmtpServer);
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential(strFrom, strFromPass);
client.DeliveryMethod = SmtpDeliveryMethod.Network;
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(strFrom, strto, strSubject, strBody);
System.Net.Mail.Attachment attachment = new System.Net.Mail.Attachment("c:\\log.log");
message.Attachments.Add(attachment);
message.BodyEncoding = System.Text.Encoding.UTF8;
message.IsBodyHtml = true;
client.Send(message);
}