Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: SMTP Problem


Message #1 by "Chris A. Nelson" <cnelson@u...> on Tue, 21 Jan 2003 22:28:25
I am trying to create an ASPX page that will automatically e-mail the 
form contents once it is submitted.  I have the following defined in my 
code:

    Dim TheMessage as String
    Dim TheMailMessage as New MailMessage
    Dim TheMailConnection as New SmtpMail

When I try to compile and view the form, I get the following error:

Compilation Error 
Description: An error occurred during the compilation of a resource 
required to service this request. Please review the following specific 
error details and modify your source code appropriately. 

Compiler Error Message: BC30390: 'System.Web.Mail.SmtpMail.Private 
Overloads Sub New()' is not accessible in this context because it 
is 'Private'.

Source Error:

 

Line 32:     Dim TheMessage as String
Line 33:     Dim TheMailMessage as New MailMessage
Line 34:     Dim TheMailConnection as New SmtpMail
Line 35:     DBConn = New OleDbConnection("Provider=sqloledb;" _ 
Line 36:         & "server=localhost;" _
 

Source File: C:\Inetpub\wwwroot\inetbook\c5\ir\sql\index.aspx    Line: 34 

Any help would be appreciated. Sorry, but I am new to the ASP .NET world, 
so still a bit shaky on my programming skills here.

Thanks,
Chris
Message #2 by "Rohit Arora" <rohit_arora@i...> on Wed, 22 Jan 2003 09:36:56 +0530
Jes make this function New() protected or public.

-----Original Message-----
From: Chris A. Nelson [mailto:cnelson@u...]
Sent: Tuesday, January 21, 2003 10:28 PM
To: aspx_beginners
Subject: [aspx_beginners] SMTP Problem


I am trying to create an ASPX page that will automatically e-mail the
form contents once it is submitted.  I have the following defined in my
code:

    Dim TheMessage as String
    Dim TheMailMessage as New MailMessage
    Dim TheMailConnection as New SmtpMail

When I try to compile and view the form, I get the following error:

Compilation Error
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.

Compiler Error Message: BC30390: 'System.Web.Mail.SmtpMail.Private
Overloads Sub New()' is not accessible in this context because it
is 'Private'.

Source Error:



Line 32:     Dim TheMessage as String
Line 33:     Dim TheMailMessage as New MailMessage
Line 34:     Dim TheMailConnection as New SmtpMail
Line 35:     DBConn = New OleDbConnection("Provider=sqloledb;" _
Line 36:         & "server=localhost;" _


Source File: C:\Inetpub\wwwroot\inetbook\c5\ir\sql\index.aspx    Line: 34

Any help would be appreciated. Sorry, but I am new to the ASP .NET world,
so still a bit shaky on my programming skills here.

Thanks,
Chris

Message #3 by "Austin Lam" <ALam@a...> on Wed, 22 Jan 2003 08:32:14 -0500
Hi Chris,

Can you send me a sample of your code as i am very interest in doing the 
same thing too

Austin

-----Original Message-----
From: Rohit Arora [mailto:rohit_arora@i...]
Sent: Tuesday, January 21, 2003 11:07 PM
To: aspx_beginners
Subject: [aspx_beginners] RE: SMTP Problem


Jes make this function New() protected or public.

-----Original Message-----
From: Chris A. Nelson [mailto:cnelson@u...]
Sent: Tuesday, January 21, 2003 10:28 PM
To: aspx_beginners
Subject: [aspx_beginners] SMTP Problem


I am trying to create an ASPX page that will automatically e-mail the
form contents once it is submitted.  I have the following defined in my
code:

    Dim TheMessage as String
    Dim TheMailMessage as New MailMessage
    Dim TheMailConnection as New SmtpMail

When I try to compile and view the form, I get the following error:

Compilation Error
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.

Compiler Error Message: BC30390: 'System.Web.Mail.SmtpMail.Private
Overloads Sub New()' is not accessible in this context because it
is 'Private'.

Source Error:



Line 32:     Dim TheMessage as String
Line 33:     Dim TheMailMessage as New MailMessage
Line 34:     Dim TheMailConnection as New SmtpMail
Line 35:     DBConn =3D New OleDbConnection("Provider=3Dsqloledb;" _
Line 36:         & "server=3Dlocalhost;" _


Source File: C:\Inetpub\wwwroot\inetbook\c5\ir\sql\index.aspx    Line: 
34

Any help would be appreciated. Sorry, but I am new to the ASP .NET 
world,
so still a bit shaky on my programming skills here.

Thanks,
Chris


*************************************************
CONFIDENTIAL
This message contains confidential information and is intended only for 
aspx_beginners. If you are not the named addressee you should not 
disseminate, distribute or copy this e-mail. Please notify the sender 
immediately by e-mail if you have received this e-mail by mistake and 
delete this e-mail from your system.

WARNING: Computer viruses can be transmitted via email. The recipient 
should check this email and any attachments for the presence of viruses. 
Anderson Power Products accepts no liability for any damage caused by 
any virus transmitted by this email.
*************************************************
Message #4 by "Austin Lam" <ALam@a...> on Wed, 22 Jan 2003 08:33:27 -0500
Hi Christ,

Can you send me the code as sample for my refrence as i am interested in 
doing the same thing too.

Austin

-----Original Message-----
From: Chris A. Nelson [mailto:cnelson@u...]
Sent: Tuesday, January 21, 2003 5:28 PM
To: aspx_beginners
Subject: [aspx_beginners] SMTP Problem


I am trying to create an ASPX page that will automatically e-mail the
form contents once it is submitted.  I have the following defined in my
code:

    Dim TheMessage as String
    Dim TheMailMessage as New MailMessage
    Dim TheMailConnection as New SmtpMail

When I try to compile and view the form, I get the following error:

Compilation Error
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.

Compiler Error Message: BC30390: 'System.Web.Mail.SmtpMail.Private
Overloads Sub New()' is not accessible in this context because it
is 'Private'.

Source Error:



Line 32:     Dim TheMessage as String
Line 33:     Dim TheMailMessage as New MailMessage
Line 34:     Dim TheMailConnection as New SmtpMail
Line 35:     DBConn =3D New OleDbConnection("Provider=3Dsqloledb;" _
Line 36:         & "server=3Dlocalhost;" _


Source File: C:\Inetpub\wwwroot\inetbook\c5\ir\sql\index.aspx    Line: 
34

Any help would be appreciated. Sorry, but I am new to the ASP .NET 
world,
so still a bit shaky on my programming skills here.

Thanks,
Chris
*************************************************
CONFIDENTIAL
This message contains confidential information and is intended only for 
aspx_beginners. If you are not the named addressee you should not 
disseminate, distribute or copy this e-mail. Please notify the sender 
immediately by e-mail if you have received this e-mail by mistake and 
delete this e-mail from your system.

WARNING: Computer viruses can be transmitted via email. The recipient 
should check this email and any attachments for the presence of viruses. 
Anderson Power Products accepts no liability for any damage caused by 
any virus transmitted by this email.
*************************************************
Message #5 by "Bob Filipiak" <bobfilipiak@a...> on Wed, 22 Jan 2003 17:46:54
Here is code that I use on our sirte so visitor's can request assistance. 
You will have to fill in appropriate values ihjn the email addresses and 
replace ServerName with the name of your SMTP server, but it should get 
you started. 

Dim mailMessage As System.Web.Mail.MailMessage = New 
System.Web.Mail.MailMessage
Dim messageText As String = ""
Dim strHTML as String = ""

                                         messageText = ""
                                         messageText = messageText 
& "<HTML>" & chr(13) & chr(10)
                                         messageText = messageText 
& "<HEAD><META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=iso-
8859-1'>" & chr(13) & chr(10)
                                         messageText = messageText 
& "<TITLE>ATSC Share Point Assistance Request Form</TITLE>" & chr(13) & 
chr(10)
                                         messageText = messageText 
& "<BODY bgColor=#ffffff>" & chr(13) & chr(10)
                                         messageText = messageText 
& "<CENTER>" & chr(13) & chr(10)
                                         messageText = messageText 
& "<TABLE bgColor=#cccccc border=1 borderColor=#cccccc 
borderColorDark=#333333"
                                         messageText = messageText & " 
borderColorLight=#ffffff cellPadding=3 cellSpacing=0 width='480'>" & chr
(13) & chr(10)
                                         'messageText = messageText & "  
<TBODY>" & chr(13) & chr(10)
                                         messageText = messageText & "  
<TR><TD bgColor=#ffffff ALIGN=CENTER>" & chr(13) & chr(10)
                                         messageText = messageText & "<P 
align=left><FONT face='Arial, Helvetica, sans-serif' size=3>" & chr(13) & 
chr(10)
                                         messageText = messageText 
& "</FONT></P><HR width=480>" & chr(13) & chr(10)
                                         messageText = messageText 
& "<TABLE bgColor=#eeeeee border=0 cellPadding=3 cellSpacing=0 
width='480'><TBODY>" & chr(13) & chr(10)
                                         messageText = messageText 
& "<TR><TD align=center><FONT face='Arial, Helvetica, sans-serif'" & chr
(13) & chr(10)
                                         messageText = messageText & " 
size=3><B>ATSC Share Point Assistance Request 
Form</B><BR></FONT></TD></TR></TABLE>" & chr(13) & chr(10)'
                                         messageText = messageText 
& "<HR>" & chr(13) & chr(10)
                                         messageText = messageText 
& "<B>Email Address:</B> " & Request("UserEmail") & "<BR>" & chr(13) & chr
(10)
                                         messageText = messageText 
& "<B>Directorate:</B> " & Request("Directorate") & "<BR>" & chr(13) & chr
(10)
                                         messageText = messageText 
& "<TABLE BORDER=0><TR><TD ALIGN=CENTER><HR WIDTH='480'></TD></TR>" & chr
(13) & chr(10)
    
                                         messageText = messageText 
& "<TR><TD ALIGN=CENTER><B>Please describe the assistance you need:</B>" 
& chr(13) & chr(10)
    
    
                                         messageText = messageText 
& "<TABLE BORDER=1 width='100%'><TR><TD>&nbsp;"
    
                                         '''''''''''''''''''''''''''''''''
'
                                         messageText = messageText &  trim
(Request("genComments"))
                                         messageText = messageText 
& "</TD></TR></TABLE><BR>" & chr(13) & chr(10)
                                         '''''''''''''''''''''''''''''''''
                                         messageText = messageText 
& "<B><I>Thanks!</I> Your Action Number is [" & recFound & "]<BR>" & chr
(13) & chr(10)
                                         messageText = messageText 
& "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;We will research the problem and get 
back to you within 48 hours.</B>" & chr(13) & chr(10)
    
                                         messageText = messageText 
& "<HR></TD></TR></TABLE>" & chr(13) & chr(10)
                                         messageText = messageText 
& "<B>This message was submitted at: <BR>" & now()  & chr(13) & chr(10)
                                         'FOR EACH fieldName IN 
Request.Form
                                         'IF NOT controlFields.Exists
(fieldName) THEN
                                         'messageText = messageText & 
fieldName & ": "+request(fieldName)+ "<BR>" +chr(13)+chr(10)
                                         'END IF
                                         'NEXT
    
                                         messageText = messageText 
& "</B></TD></TR>" & chr(13) & chr(10)
                                         'messageText = messageText 
& "</TABLE>" & chr(13) & chr(10)
                                         messageText = messageText 
& "</CENTER>" & chr(13) & chr(10)
                                         messageText = messageText 
& "</BODY></HTML>" & chr(13) & chr(10)
    
                                         CheckCourse = ""
                                         CheckCourse = Trim(Request
("crsName"))
    
    
    
    
    
Message #6 by "Austin Lam" <ALam@a...> on Wed, 22 Jan 2003 16:51:38 -0500
Thanks Chris

Austin

-----Original Message-----
From: Bob Filipiak [mailto:bobfilipiak@a...]
Sent: Wednesday, January 22, 2003 12:47 PM
To: aspx_beginners
Subject: [aspx_beginners] Re: SMTP Problem


Here is code that I use on our sirte so visitor's can request 
assistance.
You will have to fill in appropriate values ihjn the email addresses and 

replace ServerName with the name of your SMTP server, but it should get
you started.

Dim mailMessage As System.Web.Mail.MailMessage =3D New
System.Web.Mail.MailMessage
Dim messageText As String =3D ""
Dim strHTML as String =3D ""

                                         messageText =3D ""
                                         messageText =3D messageText
& "<HTML>" & chr(13) & chr(10)
                                         messageText =3D messageText
& "<HEAD><META HTTP-EQUIV=3D'Content-Type' CONTENT=3D'text/html; 
charset=3Diso-
8859-1'>" & chr(13) & chr(10)
                                         messageText =3D messageText
& "<TITLE>ATSC Share Point Assistance Request Form</TITLE>" & chr(13) &
chr(10)
                                         messageText =3D messageText
& "<BODY bgColor=3D#ffffff>" & chr(13) & chr(10)
                                         messageText =3D messageText
& "<CENTER>" & chr(13) & chr(10)
                                         messageText =3D messageText
& "<TABLE bgColor=3D#cccccc border=3D1 borderColor=3D#cccccc
borderColorDark=3D#333333"
                                         messageText =3D messageText & " 

borderColorLight=3D#ffffff cellPadding=3D3 cellSpacing=3D0 
width=3D'480'>" & chr
(13) & chr(10)
                                         'messageText =3D messageText & 
" 
<TBODY>" & chr(13) & chr(10)
                                         messageText =3D messageText & " 

<TR><TD bgColor=3D#ffffff ALIGN=3DCENTER>" & chr(13) & chr(10)
                                         messageText =3D messageText & 
"<P
align=3Dleft><FONT face=3D'Arial, Helvetica, sans-serif' size=3D3>" & 
chr(13) &
chr(10)
                                         messageText =3D messageText
& "</FONT></P><HR width=3D480>" & chr(13) & chr(10)
                                         messageText =3D messageText
& "<TABLE bgColor=3D#eeeeee border=3D0 cellPadding=3D3 cellSpacing=3D0
width=3D'480'><TBODY>" & chr(13) & chr(10)
                                         messageText =3D messageText
& "<TR><TD align=3Dcenter><FONT face=3D'Arial, Helvetica, sans-serif'" & 
chr
(13) & chr(10)
                                         messageText =3D messageText & " 

size=3D3><B>ATSC Share Point Assistance Request
Form</B><BR></FONT></TD></TR></TABLE>" & chr(13) & chr(10)'
                                         messageText =3D messageText
& "<HR>" & chr(13) & chr(10)
                                         messageText =3D messageText
& "<B>Email Address:</B> " & Request("UserEmail") & "<BR>" & chr(13) & 
chr
(10)
                                         messageText =3D messageText
& "<B>Directorate:</B> " & Request("Directorate") & "<BR>" & chr(13) & 
chr
(10)
                                         messageText =3D messageText
& "<TABLE BORDER=3D0><TR><TD ALIGN=3DCENTER><HR 
WIDTH=3D'480'></TD></TR>" & chr
(13) & chr(10)
   
                                         messageText =3D messageText
& "<TR><TD ALIGN=3DCENTER><B>Please describe the assistance you 
need:</B>"
& chr(13) & chr(10)
   
   
                                         messageText =3D messageText
& "<TABLE BORDER=3D1 width=3D'100%'><TR><TD>&nbsp;"
   
                                         
'''''''''''''''''''''''''''''''''
'
                                         messageText =3D messageText &  
trim
(Request("genComments"))
                                         messageText =3D messageText
& "</TD></TR></TABLE><BR>" & chr(13) & chr(10)
                                         
'''''''''''''''''''''''''''''''''
                                         messageText =3D messageText
& "<B><I>Thanks!</I> Your Action Number is [" & recFound & "]<BR>" & chr
(13) & chr(10)
                                         messageText =3D messageText
& "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;We will research the problem and get
back to you within 48 hours.</B>" & chr(13) & chr(10)
   
                                         messageText =3D messageText
& "<HR></TD></TR></TABLE>" & chr(13) & chr(10)
                                         messageText =3D messageText
& "<B>This message was submitted at: <BR>" & now()  & chr(13) & chr(10)
                                         'FOR EACH fieldName IN
Request.Form
                                         'IF NOT controlFields.Exists
(fieldName) THEN
                                         'messageText =3D messageText &
fieldName & ": "+request(fieldName)+ "<BR>" +chr(13)+chr(10)
                                         'END IF
                                         'NEXT
   
                                         messageText =3D messageText
& "</B></TD></TR>" & chr(13) & chr(10)
                                         'messageText =3D messageText
& "</TABLE>" & chr(13) & chr(10)
                                         messageText =3D messageText
& "</CENTER>" & chr(13) & chr(10)
                                         messageText =3D messageText
& "</BODY></HTML>" & chr(13) & chr(10)
   
                                         CheckCourse =3D ""
                                         CheckCourse =3D Trim(Request
("crsName"))
   
   
   
   
   
*************************************************
CONFIDENTIAL
This message contains confidential information and is intended only for 
aspx_beginners. If you are not the named addressee you should not 
disseminate, distribute or copy this e-mail. Please notify the sender 
immediately by e-mail if you have received this e-mail by mistake and 
delete this e-mail from your system.

WARNING: Computer viruses can be transmitted via email. The recipient 
should check this email and any attachments for the presence of viruses. 
Anderson Power Products accepts no liability for any damage caused by 
any virus transmitted by this email.
*************************************************
Message #7 by "J House" <jesse@s...> on Sun, 26 Jan 2003 16:46:36
The error you are getting is from this line
"Dim TheMailConnection as New SmtpMail", the reason is the 
System.Web.Mail.SmtpMail class is static (Shared in Visual Basic) and has 
a private constructor, so you can not create this object, but you can 
access its methods directly

i.e.

System.Web.Mail.MailMessage oMessage = new System.Web.Mail.MailMessage ();

oMessage.Subject = "Test";
oMessage.To = "someone@s...";
oMessage.From = "me@h...";
oMessage.Body = "some text";

// call the static method of the static object, pass the message object.
System.Web.Mail.SmtpMail.Send (oMessage); 

// Send also has an overloaded version that takes 4 strings
// this needs no message object
System.Web.Mail.SmtpMail.Send (from, to, subject, body); 

there is also a public property for a smtp server
System.Web.Mail.SmtpMail.SmtpServer = "some server";

>    Dim TheMessage as String
>    Dim TheMailMessage as New MailMessage
>    Dim TheMailConnection as New SmtpMail

> When I try to compile and view the form, I get the following error:

> Compilation Error 
D> escription: An error occurred during the compilation of a resource 
r> equired to service this request. Please review the following specific 
e> rror details and modify your source code appropriately. 

> Compiler Error Message: BC30390: 'System.Web.Mail.SmtpMail.Private 
O> verloads Sub New()' is not accessible in this context because it 
i> s 'Private'.

  Return to Index