Hi, may i know how do i go about to forward information in a form to a specific email address? :ehh:
Printable View
Hi, may i know how do i go about to forward information in a form to a specific email address? :ehh:
Like this:
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.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
alright, thanks alot :)
how do i test to see if it's working? i'm working on a local machine...