Windows Service ( Emailing )

  • Thread starter Thread starter Simon
  • Start date Start date
S

Simon

Hello all

Sorry if this has been disscussed before but i can't find ref/examples

I have a service that works based on the time of day , it looks into my db
and creates a few more records etc BUT i need it to email the results.

This is where i am having trouble , does anyone know how to send EMAIL from
within a service.

Simon
 
System.Web.Mail.SmtpMail will work. You need the following:

1. Service running under an account with rights to email
2. An SMTP server to send mail
3. Rights for the SMTP server to forward, if going through a corporate email
server, for example

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
Hello, Simon!

S> Sorry if this has been disscussed before but i can't find ref/examples

S> I have a service that works based on the time of day , it looks into my
S> db and creates a few more records etc BUT i need it to email the
S> results.

S> This is where i am having trouble , does anyone know how to send EMAIL
S> from within a service.

Take a look at SmtpClient class ( .NET 2.0 ). Since you want send mail from service you have to think about authentication, if your service is working under system account. SmtpClient class has Credentials property that you can use to put credentials into.

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top