using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Mail;
using System.Text;
using System.Web;
public virtual void Send(bool passTestFlag)
{
try
{
if (CheckCondition())
{
SmtpClient mail = new SmtpClient();
MailMessage msg = new MailMessage();
// 復製使用者要傳送的Mail至MailAddressCollection
AddMailAddress(msg.To, To.MailAddress);
msg.From = From.FirstMailAddress;
if (Bcc.AddressCount > 0)
{
AddMailAddress(msg.Bcc, Bcc.MailAddress);
}
if (Cc.AddressCount > 0)
{
AddMailAddress(msg.CC, Cc.MailAddress);
}
// 設定附檔
SetAttachments(msg);
msg.Body = Body.ToString();
msg.Subject = NewSubject;
msg.BodyEncoding = BodyEncoding;
msg.IsBodyHtml = _isHtmlBody;
msg.Priority = _priority;
mail.Host = SMTPHost;
mail.DeliveryMethod = SmtpDeliveryMethod.Network;
mail.UseDefaultCredentials = true;
mail.Send(msg);
}
}
catch (Exception ex)
{
}
}