string str_gEtmAil = "select mail_from,mail_to ,mail_cc,mail_bcc,mail_subject,mail_body from k_mail where mail_to <>'' and (mail_body is not null) and( mail_time='0')";
SqlConnection sqlcon = new SqlConnection(SqlHaper.SqlConString);
SqlDataReader mdr = SqlHaper.Sqldr(str_gEtmAil, sqlcon);
if (mdr.Read())
{
#region
try
{
//MailAddress from = new MailAddress(mdr["mail_from"].ToString());
//MailAddress to = new MailAddress("endyping@mamalove.com.cn,mis09@mamalove.com.cn");
MailMessage message = new MailMessage();
message.From = new MailAddress(mdr["mail_from"].ToString());
MailAddress copy = new MailAddress(mdr["mail_cc"].ToString());
message.CC.Add(copy);
//MailAddress bcopy = new MailAddress(mdr["mail_bcc"].ToString());
//message.Bcc.Add(bcopy);
message.Subject = mdr["mail_subject"].ToString();
sqlcon.Close();
string strvv = "select mail_to from k_mail where mail_to<>'' and mail_to is not null and (mail_time='0')";
SqlConnection sqlconw = new SqlConnection(SqlHaper.SqlConString);
SqlDataReader mdr2 = SqlHaper.Sqldr(strvv, sqlconw);
while (mdr2.Read())
{
message.To.Add(mdr2["mail_to"].ToString());
}
sqlconw.Close();
SmtpClient client = new SmtpClient(server); //成生SMTP传输类,发送邮件
message.IsBodyHtml = true; //设置邮件为HTML形式
string str_count = " select count(*) from mf_pos inner join tf_pos on mf_pos.os_id=tf_pos.os_id and mf_pos.os_no=tf_pos.os_no left join k_busk on tf_pos.prd_no=k_busk.sk001 left outer join prdt on prdt.prd_no=tf_pos.prd_no WHERE mf_pos.os_id='SO' AND TF_POS.OS_ID='SO' and( tf_pos.prd_no like '9%') and (tf_pos.prd_no not in (select k_busk.sk001 from k_busk where sk001 like '9%')) and (tf_pos.os_dd >= '2008-01-01')";
public static void CreateCopyMessage(string server, string name, string email)//string server
{
string str_gEtmAil = "select email from users where pk_users in (select og.fk_users from users u inner join ORGMEMBER o on o.fk_users=u.pk_users inner join ORGduty og on og.fk_org=o.fk_org and og.fk_duty='1' where u.pk_users =(select users.pk_users from users where users.username='" + name + "' ))";
//string str_gEtmAil = "select mail_from,mail_to ,mail_cc,mail_bcc,mail_subject,mail_body from k_mail where mail_to <>'' and (mail_body is not null) and( mail_time='0')";
SqlConnection sqlcon = new SqlConnection(strcon);
SqlDataReader mdr = SqlHaper.Sqldr(str_gEtmAil, sqlcon);
if (mdr.Read())
{
#region
try
{
MailAddress from = new MailAddress(email);
MailAddress to = new MailAddress(mdr["email"].ToString());
MailMessage message = new MailMessage(from,to);
message.Subject = "領貨通知";