Click here to Skip to main content
15,887,449 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello Everyone,
I here i have web application in which i want send email to several ids simultaneously on the basis of time, i.e send daily mail to some user ,weekly to some user and monthly send to some user.

I know only concept of sending mail....like

C#
 try
            {
               
                MailMessage mailMessage = new MailMessage();
                mailMessage.To.Add("sujata.shinde@jkumar.com");
                mailMessage.From = new MailAddress("shinde.sshinde.sujata@gmail.com");
                mailMessage.Subject = "ASP.NET e-mail test";
                mailMessage.Body = "Hello world,\n\nThis is an ASP.NET test e-mail!";
                mailMessage.Attachments.Add(new Attachment("C:\\Users\\Satheesh\\Desktop\\Automail.txt"));
                
                
                SmtpClient smtpClient = new SmtpClient("smtp.gmail.com");
                smtpClient.Port = 587;
                smtpClient.EnableSsl = true;

                NetworkCredential NetworkCred = new NetworkCredential("shinde.sshinde.sujata@gmail.com","*******");
                smtpClient.UseDefaultCredentials = true;
                smtpClient.Credentials = NetworkCred;
                smtpClient.Send(mailMessage);
  //              Console.WriteLine("E-Mail Sent");
                ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Email sent.');", true);
                //DateTime current_time = DateTime.Now;
                //current_time = current_time.AddSeconds(10);
                //Thread.Sleep(10000);
                 Response.Write("E-mail sent!");
            }
            catch (Exception ex)
            {
                Response.Write("Could not send the e-mail - error: " + ex.Message);

            }


Please share your ideas to send mail  daily ,weekly and montly .


thanks,
Sujata
Posted
Updated 23-Dec-15 20:27pm
v2
Comments
ketan chandpa 24-Dec-15 1:58am    
hello this comment is not regarding to your solution but please take care of this that do not provide here your personal gmail credentials.

and for your security please change your gmail password immediately.

1 solution

Suja,

This is simple. Compile your application and use Windows Task Scheduler to accomplish this. Schedule 3 tasks for:
1. Daily
2. Weekly
3. Monthly
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900