Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Problems Porting EMail code to assembly


Message #1 by "Hugh McLaughlin" <hugh@k...> on Tue, 26 Mar 2002 01:57:17
Hello Evereyone and thaks for your help in advance.  I have some code that 
sends email from an ASP.Net page.  But when I try to use the same code in 
an assembly, I am getting compiler errors.  The code is:
Imports System.Web.Mail

Public Class SendMailDB

    Dim myMessage As New MailMessage()
    Dim myMail As SmtpMail
    Dim strEmail As String
    myMessage.From = "hugh@k..."
    myMessage.To = "hugh@k..."
    myMessage.CC = "hugh@k..."
    myMessage.Subject = "Daily Statistics"
    myMessage.Body = "This message is a test " & _
    "of the daily stats program."
    myMail.SmtpServer = "localhost"
    myMail.Send(myMessage)

End Class

The compiler tells me that myMessage and myMail is not declared.  I am not 
really sure what the problem is.  Any help would be greatly appreciated.  
Thanks.
Message #2 by "Douglas Rohm" <drohm@a...> on Mon, 25 Mar 2002 21:43:27 -0500
What command did you use to compile the assembly?  I believe you have to
make reference to that namespace during compilation.

Doug

-----Original Message-----
From: Hugh McLaughlin [mailto:hugh@k...] 
Sent: Tuesday, March 26, 2002 1:57 AM
To: ASP+
Subject: [aspx] Problems Porting EMail code to assembly


Hello Evereyone and thaks for your help in advance.  I have some code
that 
sends email from an ASP.Net page.  But when I try to use the same code
in 
an assembly, I am getting compiler errors.  The code is: Imports
System.Web.Mail

Public Class SendMailDB

    Dim myMessage As New MailMessage()
    Dim myMail As SmtpMail
    Dim strEmail As String
    myMessage.From = "hugh@k..."
    myMessage.To = "hugh@k..."
    myMessage.CC = "hugh@k..."
    myMessage.Subject = "Daily Statistics"
    myMessage.Body = "This message is a test " & _
    "of the daily stats program."
    myMail.SmtpServer = "localhost"
    myMail.Send(myMessage)

End Class

The compiler tells me that myMessage and myMail is not declared.  I am
not 
really sure what the problem is.  Any help would be greatly appreciated.

Thanks.

Message #3 by "Hugh McLaughlin" <hugh@k...> on Tue, 26 Mar 2002 03:38:28
I compiled it using Visual Studio.  Also, I made sure to include the 
system.web.dll in the references.

> What command did you use to compile the assembly?  I believe you have to
make reference to that namespace during compilation.

Doug

-----Original Message-----
From: Hugh McLaughlin [mailto:hugh@k...] 
Sent: Tuesday, March 26, 2002 1:57 AM
To: ASP+
Subject: [aspx] Problems Porting EMail code to assembly


Hello Evereyone and thaks for your help in advance.  I have some code
that 
sends email from an ASP.Net page.  But when I try to use the same code
in 
an assembly, I am getting compiler errors.  The code is: Imports
System.Web.Mail

Public Class SendMailDB

    Dim myMessage As New MailMessage()
    Dim myMail As SmtpMail
    Dim strEmail As String
    myMessage.From = "hugh@k..."
    myMessage.To = "hugh@k..."
    myMessage.CC = "hugh@k..."
    myMessage.Subject = "Daily Statistics"
    myMessage.Body = "This message is a test " & _
    "of the daily stats program."
    myMail.SmtpServer = "localhost"
    myMail.Send(myMessage)

End Class

The compiler tells me that myMessage and myMail is not declared.  I am
not 
really sure what the problem is.  Any help would be greatly appreciated.

Thanks.


  Return to Index