0

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.

Edited by Jigs28

3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by GarryHillton
0

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/

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.