The simple program will send emails at the end of the month.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;

namespace SendEmailLastDayofMonth
{
    class Program
    {
        static void Main(string[] args)
        {
            DateTime lastDayofMonth = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.DaysInMonth(DateTime.Today.Year,DateTime.Today.Month));

            if(DateTime.Today == lastDayofMonth)
            {
                try
                {

                    MailMessage mM = new MailMessage();
                    mM.From = new MailAddress(”eddyblanco@gmail.com“);
                    mM.To.Add(”eddyblanco@gmail.com“);
                    mM.Subject = “Text Subject”;
                    mM.Body = “The body of the email”;
                    mM.IsBodyHtml = true;
                    mM.Priority = MailPriority.High;
                    SmtpClient sC = new SmtpClient(”smtp.mail.eddyblanco.com”);
                    sC.Send(mM);
                  

                }
                catch
                {
                 
                }
            }
        }
    }
}

Comments are closed.