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?
10 Months Ago
Related Article:Submit button on form to send to email
is a Web Development discussion thread by XxDireShadowxX that has 1 reply, was last updated 1 year ago and has been tagged with the keywords: html, submit, email.
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.Subject = "Silverlight Project Executed"
mailMsg.Body = "Config Mail"
mailMsg.IsBodyHtml = True
mailMsg.From = New MailAddress("firstname.lastname@example.org")
smtpClient.Credentials = New NetworkCredential("email@example.com", "pass1234")
smtpClient.Host = "smtp.gmail.com"
smtpClient.Port = 25
smtpClient.EnableSsl = True