Wednesday, March 28, 2012

smtp mail error

I am getting this error.

BC30451: Name 'MailMessage' is not declared.

<script runat="server">
Public Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs)
MailMessage objSMTP = New MailMessage
objSMTP.From = txtEmail.Text
objSMTP.To = txtEmail.Text
objSMTP.Subject = "Test SMTP Mail"
objSMTP.Body = "This is a test!"
SmtpMail.Send(objSMTP)
End Sub
</script>Change your declaration to

Dim objSMTP As New MailMessage

0 comments:

Post a Comment