can someone tell me how can i fix the error in :

Imports System.Web
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
smtpMail.Send("someone@microsoft.com", "jesse@contoso.com", "Subject line", "Message text.")
End Sub
End Class

the error in smtpMail

Recommended Answers

All 6 Replies

What is the error you are getting exactly please?

try this:

Imports System.Web.Mail

PublicClass Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        SmtpMail.Send("someone@microsoft.com", "jesse@contoso.com", "Subject line", "Message text.")
    End Sub
EndClass

Note the changed Imports statement and the capitalised SmtpMail object.

it's not working ..it's give me error in
Imports System.Web.Mail
and
SmtpMail

Please post the exact error, without it I can't help sorry.

Warning 1 Namespace or type specified in the Imports 'System.Web.Mail' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. C:\Documents and Settings\toto\My Documents\Visual Studio 2005\Projects\trty\trty\Form1.vb 1 9 trty

Error 2 Name 'SmtpMail' is not declared. C:\Documents and Settings\toto\My Documents\Visual Studio 2005\Projects\trty\trty\Form1.vb 5 9 trty

You need to add reference to ur projeact
Project --->> Add Reference --->> from the .Net tab select System.Web.dll

GoOd Luck

there is only system. web
system.web.mobile
system.web.regularexpressions
system.web.xml
and it didn't work

still have error in(
SmtpMail)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.