Click here to Skip to main content
15,898,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am not getting the correct code to implement this concept.

I have four textboxes and one button by name submit in my aspx page,one is from textbox,2nd is to textbox,3rd is subject textbox and last one is body textbox.

When user clicks on submit button mail should go to the particular email address were we have assigned it in the to textbox from the particular address were we have assigned it in the from textbox.

I want to know different methods to implement this concept.

thanks,
Swapna.
Posted
Comments

Sending Email[^] and Send Email in ASP.Net 2.0 Codeproject[^]both of them will give you an idea.
 
Share this answer
 
Have a look at this Microsoft Video tutorial for clarity:
Use ASP.NET to send Email from Website[^]
 
Share this answer
 
C#
MailMessage msg = new MailMessage();
msg.From = "email address";
msg.To = txtMailTo.Text;
msg.BodyFormat = MailFormat.Text;
msg.Subject = txtSubject.Text;
msg.Body = txtMessage.Text;
SmtpMail.SmtpServer = "your smtp mail server";
SmtpMail.Send(msg);

Use it, it's working fine.
 
Share this answer
 
v3

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