send email from webform

d2005

Active member
Joined
Aug 31, 2005
Messages
37
Location
ireland
Programming Experience
Beginner
i have a webform with the txtboxes

txtName
txtFrom
txtTo
txtCc
txtComments

i have the following code.
any help at all would be greatly appreciated
i have a few errors so as i cannot run it the errors shall be in red below
Public Class WebForm1

Inherits System.Web.UI.Page

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

'Put user code to initialize the page here

End Sub

Public Sub sendmail()

Dim objEmail As New MailMessage - (type mail message is not defined)

objEmail.To = txtTo.Text

objEmail.From = txtFrom.Text

objEmail.Cc = txtCc.Text

objEmail.Subject = "Test Email"

objEmail.Body = txtName.Text & ", " & txtComments.Text

' objEmail.Priority = MailPriority.High

SmtpMail.SmtpServer = "localhost" - smtpmail not declared

Try

SmtpMail.Send(EMail) - also not declared

Response.Write("Your E-mail has been sent sucessfully Thank You")

Catch exc As Exception

Response.Write("Send failure: " + exc.ToString())

End Try

End Sub

End
Class


 
lol, i did that in the end up and no errors are given, in fact a message says email sent,
but no message arrives in my mailbox

thanks
 
Back
Top