Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi have a good day !

I have a webpage in asp.net project, In this webpage I have 3 Textboxes and a submit button
When i click on submit button the data from textboxes successfully saves to sql database.
3 textboxes are UserName,Password,Email

My requirement is:
When I click on submit button the username and password should display in outlook body and email should appear in outlook CC Textbox.

Can you please help me,

Thanks
Posted

1 solution

You need to subscribe to the button click event, and then you need a block of code like this:

C#
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
message.To.Add("luckyperson@online.microsoft.com");
message.Subject = "This is the Subject line";
message.From = new System.Net.Mail.MailAddress("From@online.microsoft.com");
message.Body = "This is the message body";
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("yoursmtphost");
smtp.Send(message);


Just set the message.Body property to the contents of the Textbox's, and set the subject accordingly. This is basic stuff and there are many examples to be found on line.

You will need an SMPT server, you could use Gmail for that. Just look that up on Google.

Baxter P.
 
Share this answer
 

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