Group Discounts available for 3+ students and Corporate Clients

Windows Service with Mailing concepts in C# .net

Windows Service with Mailing concepts:-

  1. To send the mails SMTP protocol is required .
  2. 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 Its is installed.
  4. When IIS is installed then 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”;

  1. subject = “Happy Pongal”;
  2. body Format = Mail Format. Html;
  3. 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>”;

  1. Form = “Prakash @ptpl”;

//ptpl is computer name

Smtp Mail .Send (m);

}// if

“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at info@tekslate.com, we will update the article in 24 hours.”

0 Responses on Windows Service with Mailing concepts in C# .net"

    Leave a Message

    Your email address will not be published. Required fields are marked *

    Support


    Please Enter Your Details and Query.
    Three + 6