Click here to Skip to main content
15,888,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi..
I'm new to asp.net..
can anyone tell me how to send automatic email to subscribed users..
like when the admin posted new things in their website, user should be
notified automatically..

can any one explain me with example coding...

thanks in advance...
Posted

1 solution

There are a couple of approaches. You can have code in your ASP.Net site that when a user does something it sends an email.

The other approach is to write a windows service that is constantly looking at a database table to see what needs to be processed and then have it send the emails and your ASP.Net app will write events to that table.

To send emails there are tons of example online using the System.Net.Mail namespace and SMTPClient class.

http://msdn.microsoft.com/en-us/library/vstudio/system.net.mail[^]
 
Share this answer
 
Comments
priya dharshan 30-Apr-14 8:19am    
sir, how to create windows services??
ZurdoDev 30-Apr-14 8:25am    
http://www.codeproject.com/Articles/3990/Simple-Windows-Service-Sample
That is a good example. It is from older version of Visual Studio but you should still be able to follow it. Or, there are many examples online if you search for c# windows service.
priya dharshan 30-Apr-14 8:40am    
sir, i need to send automatic email for web applications..
if i have used windows services means, is it possible to use that for web applications?
ZurdoDev 30-Apr-14 8:45am    
Yes. A web application does not do anything until someones requests a page. It then serves them the page and then stops. Therefore, you can't really use a web app to run code on a regular interval. The web app will write data to a table in a database and your windows service will then read from that same table. Or, you put all your code into the web app and it only sends email as things actually happen.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900