Click here to Skip to main content
15,921,463 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I have project by C# ... in that project they are one form ... in that form I write code for user to write them details and then they will submit it to Data Base ... in seam step when they submit the details (after the press submit) the data will send to Data base and I want code to inform my by mail that some one have register ....

so the Question is : what is the code i should write it in that form so the form will send to my mail Automatically that someone was register ....

thanks
Posted
Updated 10-Jan-12 19:54pm
v2

Hi,

A good example is here in code project
 
Share this answer
 
C#
username = From;
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(From, Too);
message.Subject = mail_subject;
message.Body = "Your message body";
SmtpClient client = new SmtpClient(smtp.gmail.com, 587);
message.SubjectEncoding = Encoding.UTF8;
message.Priority = System.Net.Mail.MailPriority.Normal;
client.UseDefaultCredentials = false;
NetworkCredential credential = new NetworkCredential(username, password);
client.UseDefaultCredentials = true;
client.Credentials = credential;
try
{
client.EnableSsl = true;
client.Send(message);
}
catch
{
client.EnableSsl = false;
client.Send(message);
}
 
Share this answer
 
v2

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