Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a web form in .net to send via email

Status
Not open for further replies.

csdewan

MIS
Apr 11, 2005
16
GB
Hi All,

I’m wanting to create a form on the web in .net that lets user enter relevant data into it and then it sends the data via any email to the relevant recipient.

Was wondering what the best way would be to do this?

Any pointers or website or tutorials that anyone has used would be a great help.

Thanks.
 
Do you want the email to look the same as the form that the user entered the details into, or do you just want to email the actual details they entered?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Just want the email to have the actual details they have entered into the form.
 
In that case, it wshould be fairly simple. Something like this:
Code:
        'Create an instance of the MailMessage class
        Dim objMM As New MailMessage
        Dim strBody As New StringBuilder

        'Set the properties
        objMM.To = "someone@myemail.com"
        objMM.From = "me@myemail.com"

        'Send the email in HTML format
        objMM.BodyFormat = MailFormat.Text

        'Set the priority
        objMM.Priority = MailPriority.Normal

        'Set the subject
        objMM.Subject = "My Email"

        'Set the body
        strBody.Append("Textbox1: " & Textbox1.Text & Environment.NewLine)
        strBody.Append("Textbox2: " & Textbox2.Text & Environment.NewLine)
        objMM.Body = strBody.ToString

        'Specify the Smtp Server
        SmtpMail.SmtpServer = "127.0.0.1"

        'send the message
        SmtpMail.Send(objMM)
You'll have to import System.Web.Mail for the above example as well.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top