Skip to content

Sending online form to my email address...

Maralynn Rochat

Asked Jul 25, 2007, 6:36 AM EDT1 answer
Share
LinkedInX
Context: Aspx page using C# I have a form. I have validation. I just need to figure out how to write the code to send the form to MY email instead of an address the client types into an input box (txtTo). Here's the code I have: MailAddress objMail_fromaddress = new MailAddress(txtFrom.Text); MailAddress objMail_toaddress = new MailAddress(txtTo.Text); objMail.From = objMail_fromaddress; objMail.To.Add(objMail_toaddress); Can anyone help??

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Context: Aspx page using C# I have a form. I have validation. I just need to figure out how to write the code to send the form to MY email instead of an address the client types into an input box (txtTo).

    Here's the code I have: MailAddress objMail_fromaddress = new MailAddress(txtFrom.Text); MailAddress objMail_toaddress = new MailAddress(txtTo.Text); objMail.From = objMail_fromaddress; objMail.To.Add(objMail_toaddress); Can anyone help??



    I may be misunderstanding you, but I think you answered your own question with your intro.

    Simply replace the line:
    'MailAddress objMail_toaddress = new MailAddress(txtTo.Text);' with
    'MailAddress objMail_toaddress = new MailAddress("[email protected]");'

    obviously if your not using the txtTo box anymore you would want to remove it from your display aswell :)

    Hope that helps!
    0