Automatic email sending process is easy to using windows scheduler and use of .exe file for send email automatically. For example every day you like send email automatically for tell Good Morning! message to your friend then refer below process.
Select File->New Project->windows form application in Visual Studio.
No control is used in the form design
Double click on the form form_load event is occurred you can write where ever you want process execution code. I created mail code for send automatically mail send.
private void Form1_Load(object sender, EventArgs e)
MailMessage msg = new MailMessage("email@example.com", "firstname.lastname@example.org", "subjectofmail", "Mail_Body like Good Morning etc.");
SmtpClient mailClient = new SmtpClient("smtp.gmail.com", 587);
NetworkCredential NetCrd = new NetworkCredential("email@example.com", "fromidpassword");
mailClient.UseDefaultCredentials = false;
mailClient.Credentials = NetCrd;
mailClient.EnableSsl = true;
mailClient.DeliveryMethod = SmtpDeliveryMethod.Network;
catch (Exception ex)
How to create .exe file for my windows application?
You no need to create any .exe file after write code just build application and run application, test the application for whether you got mail or not. Then automatically .exe file is created in the source location bin->Debug folder.
How to add .exe file into windows Scheduler?
Select Control panel->Scheduled Tasks->Double click of add scheduled task
New small window is opened click next browse your .exe location (.exe in your project location bin->Debug) and add it further next click allot schedule time and which day that .exe execute (daily/monthly/weekly etc). After select all options click finish. Then whenever your scheduled time are come that .exe file run automatically and send mail to customer.
We learn in this article how to send email using windows scheduler at the specified mention time. I hope this article is help to you.