using System;
using System
using System
using System
namespace LBC
{
/// <summary>
/// 發送郵件的類
/// </summary>
public class SendMail
{
private MailMessage mailMessage;
private SmtpClient smtpClient;
private string password;//發件人密碼
/// <summary>
/// 處審核後類的實例
/// </summary>
/// <param name=
/// <param name=
/// <param name=
/// <param name=
/// <param name=
public SendMail(string To
{
mailMessage = new MailMessage();
mailMessage
mailMessage
mailMessage
mailMessage
mailMessage
mailMessage
mailMessage
this
}
/// <summary>
/// 添加附件
/// </summary>
public void Attachments(string Path)
{
string[] path = Path
Attachment data;
ContentDisposition disposition;
for (int i =
{
data = new Attachment(path[i]
disposition = data
disposition
disposition
disposition
mailMessage
}
}
/// <summary>
/// 異步發送郵件
/// </summary>
/// <param name=
public void SendAsync(SendCompletedEventHandler CompletedMethod)
{
if (mailMessage != null)
{
smtpClient = new SmtpClient();
smtpClient
smtpClient
smtpClient
smtpClient
smtpClient
}
}
/// <summary>
/// 發送郵件
/// </summary>
public void Send()
{
if (mailMessage != null)
{
smtpClient = new SmtpClient();
smtpClient
smtpClient
smtpClient
smtpClient
}
}
}
}
From:http://tw.wingwit.com/Article/program/Oracle/201311/18660.html