I have 3 textboxes..textBox1,textBox2,textBox3.I want that when user clicks on submit button all data should go to e-mail address..

Any one here can please help me to get through code?

Thanks very much

Recommended Answers

All 4 Replies

All data goes to the email address? What do you mean? Do you mean that you will send the email to three diferrent email addresses?

If that's the case, you do it this way:

SmtpClient smtp = new SmtpClient("smtpaddress");
smtp.Credentials = new NetworkCredentials("username","password");

MailMessage message = new MailMessage();

message.From = new MailAddress("YourEmailAddress");

message.To.Add(new MailAddress(textbox1.Text));
message.To.Add(new MailAddress(textbox2.Text));
message.To.Add(new MailAddress(textbox3.Text));

message.Subject = "Subject";
message.Body = "Body";

smtp.Send(message);

nope

I need that text which is entered in textBox1,textBox2 and textBox3 should go in e-mail address

Thanks

nope

I need that text which is entered in textBox1,textBox2 and textBox3 should go in e-mail address

Thanks

Again, I'm not 100% clear of your question. Why don't you use my code, but chage this one!

message.To.Add(new MailAddress(textbox1.Text + textbox2.Text + textbox3.Text));

how about the webconfig?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.