|
-
Mar 28th, 2005, 10:50 AM
#1
Thread Starter
Member
Forward Form Contents To Email
Hi, may i know how do i go about to forward information in a form to a specific email address?
-
Mar 28th, 2005, 02:17 PM
#2
Hyperactive Member
Re: Forward Form Contents To Email
Like this:
Code:
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
sendSomeMail()
End Sub
Private Sub sendSomeMail()
Dim MyMail As MailMessage = New MailMessage
MyMail.From = "[email protected]"
MyMail.To = "[email protected]"
MyMail.Subject = "Web Form Feedback"
' Grab the text in the txtq1 and txtq2 fields
' from and the webform and then send it in the body
' of the email This is not how I would do
' this in a real application but it works as an
' example an should get you started.
MyMail.Body = txtQ1.Text & " - " & txtQ2.Text
SmtpMail.SmtpServer = "mail.somewhere.com"
SmtpMail.Send(MyMail)
End Sub
Make sure that you do an Imports System.Web.Mail for code behind or the <% Import System.Web.Mail %> for inline at the top of your code. In that example I just put two fields on the webform. One named txtQ1 and the other named txtQ2 and then passed them to the body of am email. In a real web application you would probably want to validate the data in the controls as well as test for a successful email.
-
Mar 29th, 2005, 04:06 AM
#3
Thread Starter
Member
Re: Forward Form Contents To Email
alright, thanks alot
______________________________________
Warmest Regards,
Lex
______________________________________
:|: Don't Mess With The Predator :|:
-
Apr 9th, 2005, 10:27 AM
#4
Thread Starter
Member
Re: Forward Form Contents To Email
how do i test to see if it's working? i'm working on a local machine...
______________________________________
Warmest Regards,
Lex
______________________________________
:|: Don't Mess With The Predator :|:
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|