I am creating a website where i want to send email notification of every website activity like Facebook
How can i send automatic emails to logged in user?

Thank You.

To send an email is fairly easy. First you need to import the System.Net.Mail namespace to get access to everything you need. Then you create an instance of an SmtpClient (which you provide with the details regarding the email account that will be sending the email) and a MailMessage instance which holds the subject, message, attachments, etc. Then send it.
You'll find plenty of good tutorials online. Here is one to start you off:
http://www.dreamincode.net/forums/topic/57355-sending-e-mail-messages-using-c%23/

You need to have a service (or an application) running on the server (or which is run on the server as regular intervals) which monitors your data source, and sends the emails.
This code was developed in VB.Net code, you have to convert the code.

        Dim mailMsg As MailMessage = New MailMessage
        Dim smtpClient As SmtpClient = New SmtpClient

        mailMsg.To.Add("xyz@gmail.com")
        mailMsg.Subject = "Silverlight Project Executed"
        mailMsg.Body = "Config Mail"
        mailMsg.Attachments.Add(New Attachment("AttachedFileName"))

        mailMsg.IsBodyHtml = True
        mailMsg.From = New MailAddress("abc@gmail.com")

        smtpClient.Credentials = New NetworkCredential("abc@gmail.com", "pass1234")
        smtpClient.Host = "smtp.gmail.com"
        smtpClient.Port = 25
        smtpClient.EnableSsl = True

        smtpClient.Send(mailMsg)

Source: forums.silverlight.net/t/162682.aspx/1

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.