private void button1_Click(object sender, EventArgs e)
{
string strCon = "Data Source=SFIS.WORLD;Persist Security Info=True;User ID = sfis1;Password= sfcbasetable1;Unicode=True";
string strSQL = " SELECT * FROM sfisM4.R_sendmail_group_t where (send_flag='Y' or always_flag='Y') and mail_group ='CMO_expiry'";
string FilePath;
string Subject = "";
string Content = "";
FilePath = Application.StartupPath; //獲取程式當前路徑
try
{
// LotusSendMail SendMail = new LotusSendMail();
// SendMail.LotusInitialize("2627");
string Mail_Group;
String MailList;
string cc = "";
string bcc = "";
OracleConnection Con = new OracleConnection(strCon);
OracleDataAdapter da = new OracleDataAdapter(strSQL, Con);
Con.Open();
DataTable dt = new DataTable();
da.Fill(dt);
dataGridView1.DataSource = dt.DefaultView;
dt.Columns.Add("NotesID");
if (dt.Rows.Count > 0)
{
for (int i = 0; i <= dt.Rows.Count - 1; i++)
{
Mail_Group = dt.Rows[i][0].ToString().Trim();
//------------
Con.Close();
}
catch (Exception aa)
{
// MessageBox.Show(aa.Message.ToString()) ;
// LotusSendMail SendMail = new LotusSendMail();
// SendMail.LotusInitialize("2627");
string MailList2 = "lily.jh.luo/NSG/FOXCONN@FOXCONN"; //This will send exception message to me if error occur;
string Subject2 = "Public Send_Mail Program SOS !!";
string Content2 = "Dear lily," + "\n" + " " + "Please slove the problem as soon as possible!!" + "\n" + aa.Message.ToString();
string FilePath2 = "";
// SendMail.SendMail(MailList2, "", "", Subject2, Content2, FilePath2);
SendMailForNotes(MailList2, "", "", Subject2, Content2, FilePath2);
}
// this.Close();
}