Home All Groups Group Topic Archive Search About

Problem almost solved - Sending Mail

Author
30 Aug 2006 4:58 PM
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( _
   "Brad.Kings***@orcsweb.com", "B***@KingsleyTeam.com")
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( _
   "te***@domain.com", "te***@domain.com")
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)%>

Author
30 Aug 2006 7:50 PM
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.

Show quote
"AbraAbraCadabra" <n**@gsw-inc.com> wrote in message
news:Ob29%23VFzGHA.4176@TK2MSFTNGP06.phx.gbl...
> 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( _
>   "Brad.Kings***@orcsweb.com", "B***@KingsleyTeam.com")
> 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( _
>   "te***@domain.com", "te***@domain.com")
> 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)%>
>
Author
30 Aug 2006 8:00 PM
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











Show quote
>
> "AbraAbraCadabra" <n**@gsw-inc.com> wrote in message
> news:Ob29%23VFzGHA.4176@TK2MSFTNGP06.phx.gbl...
>> 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( _
>>   "Brad.Kings***@orcsweb.com", "B***@KingsleyTeam.com")
>> 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( _
>>   "te***@domain.com", "te***@domain.com")
>> 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)%>
>>
>
>
Author
30 Aug 2006 8:04 PM
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?

Show quote
"AbraAbraCadabra" <n**@gsw-inc.com> wrote in message
news:%23qCO47GzGHA.3584@TK2MSFTNGP02.phx.gbl...
>> 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
>
>
>
>
>
>
>
>
>
>
>
>>
>> "AbraAbraCadabra" <n**@gsw-inc.com> wrote in message
>> news:Ob29%23VFzGHA.4176@TK2MSFTNGP06.phx.gbl...
>>> 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( _
>>>   "Brad.Kings***@orcsweb.com", "B***@KingsleyTeam.com")
>>> 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( _
>>>   "te***@domain.com", "te***@domain.com")
>>> 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)%>
>>>
>>
>>
>
>
Author
30 Aug 2006 8:28 PM
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?
Author
30 Aug 2006 8:39 PM
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.

Show quote
"AbraAbraCadabra" <n**@gsw-inc.com> wrote in message
news:uk0waLHzGHA.3584@TK2MSFTNGP02.phx.gbl...
>> 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?
>
>
>
Author
30 Aug 2006 8:48 PM
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?

AddThis Social Bookmark Button