hi,
pls tell me....
how to generate a msg as a reminder for our important dates like "upcoming birthday"
thanks
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Kirtan PatelRank #292 · 8.6K reputationPosted Aug 18, 2009, 7:17 AM EDT
Here i have Coded what you needed after lot of thinking ...
dont Forget to mark "Do you like answer" it will give me some Credit :)
----------------------------------------------------------------------------------------------------------------------
+ Application Will Store all the reminder in Database and Will Show Note About Upcoming reminder On Screen
+ It Will Check For New reminders Every 1 Hour and Send mail About Upcoming Reminders to User
+ to Keep Alerting User You have to Start Application When Computer Start so that Application Will Send Mail on Regular Intervals
+ I have included Project File Take A Look at That So you can get Better Idea See Link at bottom:)
---------------------------------------------------------------------------------------------------
private void Form1_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True;User Instance=True");
con.Open();
SqlCommand comm = new SqlCommand("select * from Reminder",con);
SqlDataAdapter da = new SqlDataAdapter(comm);
DataTable dt = new DataTable();
da.Fill(dt);
dataGridView1.DataSource = dt;
con.Close();
CheckEvents();
}
//Check For new Events and Send mail To User About reminders At Every 1 hour
private void timer1_Tick(object sender, EventArgs e)
{
CheckEvents();
SendMail();
}
public void CheckEvents()
{
foreach (DataGridViewRow r in dataGridView1.Rows)
{
if (dataGridView1.Rows.Count > 0)
{
DateTime DateToCompare = DateTime.Parse(r.Cells[2].Value.ToString());
DateTime TodayDate = DateTime.Now;
TimeSpan t = DateToCompare.Subtract(TodayDate);
string DateOfReminder = r.Cells[2].Value.ToString();
string ReminderNote = r.Cells[1].Value.ToString();
int DaysLeft = t.Days;
if (t.Days <= 10)
{
string FinalString = DateOfReminder + "==>" + ReminderNote + "==>Days left " + DaysLeft;
richTextBox1.Text += FinalString + "\n";
}
}
}
}
//Sending Mail About Reminder to User
public void SendMail()
{
SmtpClient smtp = new SmtpClient("smtp.gmail.com", 786);
smtp.Credentials = new NetworkCredential("username", "password");
smtp.EnableSsl = true;
MailMessage msg = new MailMessage(new MailAddress("[email protected]"), new MailAddress("[email protected]"));
msg.Subject = "Private Reminder";
msg.Body = richTextBox1.Text;
smtp.Send(msg);
}
Kirtan PatelRank #292 · 8.6K reputationPosted Aug 17, 2009, 2:41 AM EDT
can you Provide me some more detailes what exactly you want to achieve as final result
Explain your scenario a lil bit more so can take a look at your problem batter :)
urmila kandari22 reputationPosted Aug 17, 2009, 9:11 PM EDT
i just want like we' ve form where we'll fill all the important dates like our insurance date, some impt meeting dates ect. nd before ten days automaticaly it start to generat messages on our valid email -id that ur meeting on that date (same we had fill on form )
i means it work like our moblie reminder
thanks
urmila kandari22 reputationPosted Aug 23, 2009, 9:29 PM EDT
thanks for help........