public void Sender(MailMessage msg)
{
smtp = this.ExecuteScalar("select smtp from config").Trim();
uname = this.ExecuteScalar("select username from config").Trim() ;
pwd = this.ExecuteScalar("select password from config").Trim();
SmtpClient sc = new SmtpClient(smtp);
sc.UseDefaultCredentials = false;
sc.Credentials = new System.Net.NetworkCredential(uname, pwd);
sc.DeliveryMethod = SmtpDeliveryMethod.Network;
sc.Send(msg);
}
/// <summary>
/// 打包成完整邮件
/// </summary>
/// <param name="result">查询语句</param>
/// <param name="to">收信人地址</param>
public void Msg(string result,string to)
{
ufrom = this.ExecuteScalar("select ufrom from config").Trim();
webname = this.ExecuteScalar("select webname from config");
string subj = webname + "-" + DateTime.Now.ToShortDateString() + "Bid Info";
string bod = EnHtml(result);
MailMessage mm = new MailMessage(ufrom, to, subj, bod);
mm.IsBodyHtml = true;
Sender(mm);
}
{
smtp = this.ExecuteScalar("select smtp from config").Trim();
uname = this.ExecuteScalar("select username from config").Trim() ;
pwd = this.ExecuteScalar("select password from config").Trim();
SmtpClient sc = new SmtpClient(smtp);
sc.UseDefaultCredentials = false;
sc.Credentials = new System.Net.NetworkCredential(uname, pwd);
sc.DeliveryMethod = SmtpDeliveryMethod.Network;
sc.Send(msg);
}
/// <summary>
/// 打包成完整邮件
/// </summary>
/// <param name="result">查询语句</param>
/// <param name="to">收信人地址</param>
public void Msg(string result,string to)
{
ufrom = this.ExecuteScalar("select ufrom from config").Trim();
webname = this.ExecuteScalar("select webname from config");
string subj = webname + "-" + DateTime.Now.ToShortDateString() + "Bid Info";
string bod = EnHtml(result);
MailMessage mm = new MailMessage(ufrom, to, subj, bod);
mm.IsBodyHtml = true;
Sender(mm);
}