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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hitting submit button and a generated email is sent

Status
Not open for further replies.

JJ297

Programmer
Jun 27, 2007
30
0
0
US
I'm having problems with my code. Can somone take a look and tell me what I've left out?

Thanks!

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim objEmail As New System.Net.Mail.MailMessage()
objEmail = Server.CreateObject("CDO.Message")
objEmail.To = "nc297@yahoo.com"
objEmail.From = "nc297@yahoo.com"
objEmail.CC = "nc297@yahoo.com"
objEmail.Subject = "EDCS Question"
objEmail.Body = "Your quesiton" & ", " & "your comments"
objEmail.Priority = "MailPriority.High"

Try
SmtpMail.Send(objEmail)
Response.Write("Email was sent")

Catch exc As Exception
Response.Write("Send failure: " + exc.ToString())
End Try

End Sub
End Class
 
asp.net doesn't use the CDO.Message object. at least not this way.

check out the System.Web.Mail (1.1) or System.Net.Mail(2.0) namespaces. this is where the objects are located to process email.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top