Windows Service with Mailing concepts in C# .net

Ratings:
(4)
Views:193
Banner-Img
  • Share this blog:

 

Windows Service with Mailing concepts:-

  1. To send the mails SMTP protocol is required.
  2. The protocol provides a set of rules, which need to be followed while transferring the data over the network.
  3. Smtp will be installed by default when It is installed.
  4. When IIS is installed then the Following Folder Structure will be created by default.

    Screenshot_8  

EX: 2 on windows Service with mailing concepts:-

  • Developing a service to send a mail at 12:30
  • Open windows Service project with project name WS2

  Project  Menu  arrrowAdd Reference  arrrow System .wed  (this is required for Mail Message class) Place Timer  (System .Timers  )control  arrrow Properties   Enabled = true Interval = 60, 000   Interval 100ms                      w:30                      12:30:00 01 1 sec   = 600                                                       .. 100ms = 60                                                                    … 1        60,000                                                             59 60,000  

Using System. web. Mail;

Code for Timer 1 _ Elapsed Event

{

Int sh =Date Time . Now. Hour ;

// 24 hrs format

Int sum = Date Time . Now. Minute;

If (sh == 12 && sm ==30)

{

Mail  Message  m = new Mail Message ();

M .to  = “teja @ yahoo.com”; m.cc = “varoon @india.com”;

subject = “Happy Pongal”;
body Format = Mail Format. Html;
body = <h1>Happy pongal </h1> <hr>
<h2><Font color  = Green> Dear Friends,   This is to inform  you that, our next class will be on 17th  jan, 2009 </Font> </h2>”;

Form = “Prakash @ptpl”;
//ptpl is computer name Smtp Mail .Send (m);

}

// if

You liked the article?

Like : 0

Vote for difficulty

Current difficulty (Avg): Medium

Recommended Courses

1/15

About Author
Authorlogo
Name
TekSlate
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.


Stay Updated


Get stories of change makers and innovators from the startup ecosystem in your inbox