Problem almost solved - Sending Mail

A

AbraAbraCadabra

Ok I think I've almost got my problem solved. I am using this code to send
mail.
I am simply pasting it into an .ASP page. Why doesn't this code work? I do
have
..NET 2.0 installed, but I haven't done any configuration to it. Am I
missing something?


'Create a new MailMessage object and specify the"From" and "To" addresses
Dim Email As New System.Net.Mail.MailMessage( _
"(e-mail address removed)", "(e-mail address removed)")
Email.Subject = "test subject"
Email.Body = "this is a test"
Dim mailClient As New System.Net.Mail.SmtpClient()
'This object stores the authentication values
Dim basicAuthenticationInfo As _
New System.Net.NetworkCredential("username", "password")
'Put your own, or your ISPs, mail server name onthis next line
mailClient.Host = "Mail.RemoteMailServer.com"
mailClient.UseDefaultCredentials = False
mailClient.Credentials = basicAuthenticationInfo
mailClient.Send(Email)
<%'Create a new MailMessage object and specify the"From" and "To" addresses
Dim Email As New System.Net.Mail.MailMessage( _
"(e-mail address removed)", "(e-mail address removed)")
Email.Subject = "test subject"
Email.Body = "this is a test"
Dim mailClient As New System.Net.Mail.SmtpClient()
'This object stores the authentication values
Dim basicAuthenticationInfo As _
New System.Net.NetworkCredential("username", "password")
'Put your own, or your ISPs, mail server name onthis next line
mailClient.Host = "Mail.RemoteMailServer.com"
mailClient.UseDefaultCredentials = False
mailClient.Credentials = basicAuthenticationInfo
mailClient.Send(Email)%>
 
M

Marina Levit [MVP]

Any .ASP page will not run under asp.net, it will run under asp. You can't
have .NET code in an ASP page unless you configure IIS to handle all
requests to .asp pages.
 
A

AbraAbraCadabra

Any .ASP page will not run under asp.net, it will run under asp. You can't
have .NET code in an ASP page unless you configure IIS to handle all
requests to .asp pages.


So then what should I do? I am trying to use ASP to send
mail out to an SMTP server that requires authentication and
I was told to upgrade to .NET 2.0 and I would have additional
features. But apparently I they are not working for me.
Any ideas on what I should do next? I can re-configure
my IIS if I need to do that.

Paul
 
M

Marina Levit [MVP]

Well, you either decide you are using ASP or ASP.NET.

If you want to use ASP, then you can't use .NET code like that. If whatever
ASP supports doesn't support authentication, you need to find an email
component you can use from ASP.

Or, you can switch over to ASP.NET, and then use .NET code.

You can't mix the 2 technologies like you are trying to do.

If you reconfigure IIS to process ASP pages as ASP.NET pages, then why not
simply make the pages ASP.NET to begin with, since it will be the
equivalent?
 
A

AbraAbraCadabra

Well, you either decide you are using ASP or ASP.NET.
If you want to use ASP, then you can't use .NET code like that. If
whatever ASP supports doesn't support authentication, you need to find an
email component you can use from ASP.

Or, you can switch over to ASP.NET, and then use .NET code.

You can't mix the 2 technologies like you are trying to do.

If you reconfigure IIS to process ASP pages as ASP.NET pages, then why not
simply make the pages ASP.NET to begin with, since it will be the
equivalent?

Oh I think I see now. I didn't realize the two technologies couldn't be
mixed. I have an entire website that is written in ASP and note ASP.NET.
If I configure my IIS to support ASP.NET will my website still run? Or do I
have to make a bunch of changes to it? And then how do I make sure my IIS
is configured for ASP.NET and not just ASP?
 
M

Marina Levit [MVP]

Everything will still run, ASP will still run just fine.

Once you install .NET, IIS should get configured to run .aspx files under
ASP.NET and so forth. So you can start creating asp.net applications, and
they should just run.
 
A

AbraAbraCadabra

Once you install .NET, IIS should get configured to run .aspx files under
ASP.NET and so forth. So you can start creating asp.net applications, and
they should just run.

Oh ok. I have already done that. So then all I need to do is to start
using .aspx files instead of .asp files and that will allow me to run
ASP.NET?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top