mathieu_cupryk
asked on
Using Import Name Spaces
I am working on ImportNameSpaces, here is the code...
<%@Import NameSpace="System.Web.Mail "%>
<Script runat="server">
Sub Page_Load
Dim mailMessage As SmtpMail
mailMessage.Send( _
"bob@somewhere.com",_
"alice@somewhere.com",_
"Sending Mail!",_
"Hello!")
End Sub
</Script>
<html>
<head>
<title>ImportNameSpace</ti tle>
</head>
<body>
<h2>Email Sent!</h2>
</body>
</html>
I am getting an error only when I try to dispaly in the browser but not in design mode in Visual Studio.
************************** ********** ********** ********** ********** ********** ********
Here is one error I get when I take out the underscore....(
"bob@somewhere.com",_
"alice@somewhere.com",_
"Sending Mail!","Hello!"_ )
Exception Details: System.Runtime.InteropServ ices.COMEx ception: The "SendUsing" configuration value is invalid.
Source Error:
Line 6: Dim mailMessage As SmtpMail
Line 7:
Line 8: mailMessage.Send("bob@some where.com" ,"alice@so mewhere.co m","Sendin g Mail!","Hello!" )
Line 9: End Sub
Line 10: </Script>
Source File: c:\inetpub\wwwroot\simple0 01\ImportN ameSpace.a spx Line: 8
************************** ********** ********** ********** ********** ********** *********
Now if I put the underscore back in I get this 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: BC30201: Expression expected.
Source Error:
Line 6: Dim mailMessage As SmtpMail
Line 7:
Line 8: mailMessage.Send(
Line 9: "bob@somewhere.com",_
Line 10: "alice@somewhere.com",_
Source File: c:\inetpub\wwwroot\simple0 01\ImportN ameSpace.a spx Line: 8
Can you explain what it is I am doing wrong. I have had someone else look at it and they dont see the error either.
Any help would be wonderful.
Thanks in Advance.
M
<%@Import NameSpace="System.Web.Mail
<Script runat="server">
Sub Page_Load
Dim mailMessage As SmtpMail
mailMessage.Send( _
"bob@somewhere.com",_
"alice@somewhere.com",_
"Sending Mail!",_
"Hello!")
End Sub
</Script>
<html>
<head>
<title>ImportNameSpace</ti
</head>
<body>
<h2>Email Sent!</h2>
</body>
</html>
I am getting an error only when I try to dispaly in the browser but not in design mode in Visual Studio.
**************************
Here is one error I get when I take out the underscore....(
"bob@somewhere.com",_
"alice@somewhere.com",_
"Sending Mail!","Hello!"_ )
Exception Details: System.Runtime.InteropServ
Source Error:
Line 6: Dim mailMessage As SmtpMail
Line 7:
Line 8: mailMessage.Send("bob@some
Line 9: End Sub
Line 10: </Script>
Source File: c:\inetpub\wwwroot\simple0
**************************
Now if I put the underscore back in I get this 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: BC30201: Expression expected.
Source Error:
Line 6: Dim mailMessage As SmtpMail
Line 7:
Line 8: mailMessage.Send(
Line 9: "bob@somewhere.com",_
Line 10: "alice@somewhere.com",_
Source File: c:\inetpub\wwwroot\simple0
Can you explain what it is I am doing wrong. I have had someone else look at it and they dont see the error either.
Any help would be wonderful.
Thanks in Advance.
M
u should have a space between the comma and the _
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Well I did as You said, It is still giving me an error.So that wasnt the problem.
Thanks for trying. There is something else in there.
m
Thanks for trying. There is something else in there.
m
If you use Google to search for the error message, you will usually find the answer rather quickly as well.
http://www.google.com/search?q=The+%22SendUsing%22+configuration+value+is+invalid&sourceid=mozilla-search&start=0&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:en-US:official
http://www.systemwebmail.com/faq/4.2.2.aspx
http://www.google.com/search?q=The+%22SendUsing%22+configuration+value+is+invalid&sourceid=mozilla-search&start=0&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:en-US:official
http://www.systemwebmail.com/faq/4.2.2.aspx
ASKER
Can you reference a mail server to do the page?
I changed the code a bit.
Now if I look at it in design mode it tells me the email is sent. So the reason I can not view it in the browser is because I dont have the SmtpMail.SmtpServer?
I changed the code a bit.
Now if I look at it in design mode it tells me the email is sent. So the reason I can not view it in the browser is because I dont have the SmtpMail.SmtpServer?
There is a way to configure the server with a default mail server if you don't set it, I'm not sure how it is done though.