Database Reference
In-Depth Information
SmtpClient sc = new SmtpClient("localhost");
sc.Send(nMail);
}
}
}
To test the e-mail, here is a simple
Simple Mail Transfer Protocol
(
SMTP
) listener that
will intercept the e-mails locally on port
25
to view, or rather test, your e-mail sending
scenarios. It can be found at
http://smtp4dev.codeplex.com/
. When the e-mail is sent to the
localhost, it will be recorded for review in the smtp4dev software.
To receive a check only on a daily schedule, say 09:00 A.M, the Windows Task Scheduler
normally takes a console program such as this one to set a daily running schedule. It's
easy to use Task Scheduler to set up a daily recurring task that will just execute this con-
sole program to send a daily e-mail. To use the Task Scheduler, just see
ht-
tp://technet.microsoft.com/en-us/library/cc766428.aspx
.
We could add tasks to check the
database table, to see whether RavenDB is running, to get a total of the messages, and
more. This is just a beginning sample from a piece of code that monitors many different
endpoints that we will cover in the upcoming chapter.