Monday, October 19, 2015

Email Templates

Sample
Main program
static void Main(string[] args)
        {
            new Email().Run();
        }


Cs.file

public class Email
    {
       public void Run()
       {
           try
           {
               System.Net.Mail.MailMessage newmsg = new System.Net.Mail.MailMessage();

               newmsg.From = new MailAddress("from address full");

               newmsg.Subject = "Testing2";
               newmsg.To.Add("to address");
               //newmsg.To.Add("choulla.naresh@gmail.com");
               newmsg.Body = "Hellooooo2";
               SmtpClient smtp = new SmtpClient();
               smtp.Host = "host address";
//port number
               smtp.Port = "port number";
               smtp.Credentials = new System.Net.NetworkCredential("username",                      "password");
               //smtp.UseDefaultCredentials = false;
               smtp.EnableSsl = false;
               smtp.Send(newmsg);
           }
           catch(Exception Ex)
           {
               //smtp.Send(msg);
           }
       }

    }