473,383 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Why does System.Web.Mail work in development and not in production?

Hi,

I've posted this question before but didn't get anywhere with it.
Please help me out if you know of a solution for it.

I got "InnerException: Unable to connect to remote server"..."No
connection could be made because the target machine actively refused
it" when I attempted to send an email through my Intranet app that is
written in asp.net 2.0. The smtp server is a local server and it uses
Port 25. The Authentication is set to Anonymous Access. I tried
pointing to the SMTP gateway on my Exchange server and I ran into the
same problem. My organization uses Mcafee 8.5i. Does that have to do
with anything? Here's my code:
<system.net>
<mailSettings>
<smtp>
<network host="10.162.22.72" />
</smtp>
</mailSettings>
</system.net>
Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SendEmail.Click
Const ToAddress As String = "some...@somewhere.com"
Dim mm As New MailMessage(UsersEmail.Text, ToAddress)
mm.Subject = Subject.Text
mm.Body = Body.Text
mm.IsBodyHtml = False
Dim smtp As New SmtpClient
smtp.Send(mm)
End Sub
In the <network host.. /section, I did not specify a username and
password because I set the smtp server authentication mode is set to
Anonymous Access. Can someone please tell me what I did wrong? I
couldn't find anything on the Web that could point me in the right
direction.
Thanks,
Jon

Sep 5 '07 #1
9 2292
"Homer" <Ho*******@gmail.comwrote in message
news:11*********************@r29g2000hsg.googlegro ups.com...
My organization uses Mcafee 8.5i. Does that have to do with anything?
Could be - McAfee is know to cause problems with System.Web.Mail:
http://www.google.co.uk/search?sourc...%2eMail+McAfee

BTW, why are using System.Web.Mail and not System.Net.Mail...? Are you stuck
on ASP.NET v1.1...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Sep 5 '07 #2
On Sep 5, 3:59 pm, "Mark Rae [MVP]" <m...@markNOSPAMrae.netwrote:
"Homer" <HomerS...@gmail.comwrote in message

news:11*********************@r29g2000hsg.googlegro ups.com...
My organization uses Mcafee 8.5i. Does that have to do with anything?

Could be - McAfee is know to cause problems with System.Web.Mail:http://www.google.co.uk/search?sourc...hl=en-GB&ie=UT...

BTW, why are using System.Web.Mail and not System.Net.Mail...? Are you stuck
on ASP.NET v1.1...?

--
Mark Rae
ASP.NET MVPhttp://www.markrae.net
My bad, typo. I'm using System.Net.Mail. Unfortunately, I don't have
access to the McAfee VirusScan Console to add the W3wp.exe to the
exclusion list. Do you know if that would fix it?

Sep 5 '07 #3
"Homer" <Ho*******@gmail.comwrote in message
news:11*********************@19g2000hsx.googlegrou ps.com...
My bad, typo. I'm using System.Net.Mail.
Grrrrrrr....! ;-)
Unfortunately, I don't have access to the McAfee VirusScan Console
to add the W3wp.exe to the exclusion list. Do you know if that would fix
it?
Yes, almost certainly...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Sep 5 '07 #4
re:
!I got "InnerException: Unable to connect to remote server".

Can you ping 10.162.22.72 from the box which hosts the mail code ?


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Homer" <Ho*******@gmail.comwrote in message news:11*********************@r29g2000hsg.googlegro ups.com...
Hi,

I've posted this question before but didn't get anywhere with it.
Please help me out if you know of a solution for it.

I got "InnerException: Unable to connect to remote server"..."No
connection could be made because the target machine actively refused
it" when I attempted to send an email through my Intranet app that is
written in asp.net 2.0. The smtp server is a local server and it uses
Port 25. The Authentication is set to Anonymous Access. I tried
pointing to the SMTP gateway on my Exchange server and I ran into the
same problem. My organization uses Mcafee 8.5i. Does that have to do
with anything? Here's my code:
<system.net>
<mailSettings>
<smtp>
<network host="10.162.22.72" />
</smtp>
</mailSettings>
</system.net>
Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SendEmail.Click
Const ToAddress As String = "some...@somewhere.com"
Dim mm As New MailMessage(UsersEmail.Text, ToAddress)
mm.Subject = Subject.Text
mm.Body = Body.Text
mm.IsBodyHtml = False
Dim smtp As New SmtpClient
smtp.Send(mm)
End Sub
In the <network host.. /section, I did not specify a username and
password because I set the smtp server authentication mode is set to
Anonymous Access. Can someone please tell me what I did wrong? I
couldn't find anything on the Web that could point me in the right
direction.
Thanks,
Jon

Sep 5 '07 #5
On Sep 5, 4:28 pm, "Juan T. Llibre" <nomailrepl...@nowhere.comwrote:
re:
!I got "InnerException: Unable to connect to remote server".

Can you ping 10.162.22.72 from the box which hosts the mail code ?

Juan T. Llibre, asp.net MVP
asp.net faq :http://asp.net.do/faq/
foros de asp.net, en español :http://asp.net.do/foros/
======================================

"Homer" <HomerS...@gmail.comwrote in messagenews:11*********************@r29g2000hsg.go oglegroups.com...
Hi,
I've posted this question before but didn't get anywhere with it.
Please help me out if you know of a solution for it.
I got "InnerException: Unable to connect to remote server"..."No
connection could be made because the target machine actively refused
it" when I attempted to send an email through my Intranet app that is
written in asp.net 2.0. The smtp server is a local server and it uses
Port 25. The Authentication is set to Anonymous Access. I tried
pointing to the SMTP gateway on my Exchange server and I ran into the
same problem. My organization uses Mcafee 8.5i. Does that have to do
with anything? Here's my code:
<system.net>
<mailSettings>
<smtp>
<network host="10.162.22.72" />
</smtp>
</mailSettings>
</system.net>
Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SendEmail.Click
Const ToAddress As String = "some...@somewhere.com"
Dim mm As New MailMessage(UsersEmail.Text, ToAddress)
mm.Subject = Subject.Text
mm.Body = Body.Text
mm.IsBodyHtml = False
Dim smtp As New SmtpClient
smtp.Send(mm)
End Sub
In the <network host.. /section, I did not specify a username and
password because I set the smtp server authentication mode is set to
Anonymous Access. Can someone please tell me what I did wrong? I
couldn't find anything on the Web that could point me in the right
direction.
Thanks,
Jon- Hide quoted text -

- Show quoted text -
Yes I could ping it. Grrrrrrrrrr...

Sep 5 '07 #6
You can download this sample code:
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!138.entry

and see if it could be the authentication mechanism.

None
Basic
SSL

There is downloadable code, just to make the check quick and clear.


"Homer" <Ho*******@gmail.comwrote in message
news:11*********************@r29g2000hsg.googlegro ups.com...
Hi,

I've posted this question before but didn't get anywhere with it.
Please help me out if you know of a solution for it.

I got "InnerException: Unable to connect to remote server"..."No
connection could be made because the target machine actively refused
it" when I attempted to send an email through my Intranet app that is
written in asp.net 2.0. The smtp server is a local server and it uses
Port 25. The Authentication is set to Anonymous Access. I tried
pointing to the SMTP gateway on my Exchange server and I ran into the
same problem. My organization uses Mcafee 8.5i. Does that have to do
with anything? Here's my code:
<system.net>
<mailSettings>
<smtp>
<network host="10.162.22.72" />
</smtp>
</mailSettings>
</system.net>
Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SendEmail.Click
Const ToAddress As String = "some...@somewhere.com"
Dim mm As New MailMessage(UsersEmail.Text, ToAddress)
mm.Subject = Subject.Text
mm.Body = Body.Text
mm.IsBodyHtml = False
Dim smtp As New SmtpClient
smtp.Send(mm)
End Sub
In the <network host.. /section, I did not specify a username and
password because I set the smtp server authentication mode is set to
Anonymous Access. Can someone please tell me what I did wrong? I
couldn't find anything on the Web that could point me in the right
direction.
Thanks,
Jon

Sep 6 '07 #7
The problem is almost certainly one of security. SMTP is a network protocol
that uses a specific TCP port (usually 25) to send a message from a client
application to an SMTP server. The SMTP server then sends the message to the
end recipient, usually a POP3 server like Exchange. There are many security
issues involved. First, the SMTP server must be configured correctly to
allow the client to send a message to it. This involves configuring the
Authentication correctly on the SMTP server, and the client using the
correct Authentication method to connect. It also involves configuring Relay
permissions correctly on the SMTP server.

If the SMTP server is not on the same machine as the client, it also
involves the network security between the machines on the network, whether
it is a private network or a public one. The IP address in your MailSetting
section indicates that the SMTP server is on a private network, and I will
assume that the client application is on a machine in the same private
network. Therefore, Firewall software on either the client machine or SMTP
server machine may need to be configured to allow the SMTP traffic.

Assuming that the messages is received by the SMTP server, the SMTP server
can be configured to send the message by any of several means. Inside a
private network, this generally requires that the SMTP server be mapped to a
public IP address using NAT (Network Address Translation), or that it be
configured to use another SMTP server as a "Smart Host." If the SMTP server
has a public IP address, it must be allowed by the network Firewall to pass
the message through. If it uses a Smart Host, the Smart Host must be
configured to allow messages from the client SMTP server, and allowed by the
network Firewall to pass the message through.

I hope you have a network administrator handy to help you figure out what
the problem is.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Homer" <Ho*******@gmail.comwrote in message
news:11*********************@r29g2000hsg.googlegro ups.com...
Hi,

I've posted this question before but didn't get anywhere with it.
Please help me out if you know of a solution for it.

I got "InnerException: Unable to connect to remote server"..."No
connection could be made because the target machine actively refused
it" when I attempted to send an email through my Intranet app that is
written in asp.net 2.0. The smtp server is a local server and it uses
Port 25. The Authentication is set to Anonymous Access. I tried
pointing to the SMTP gateway on my Exchange server and I ran into the
same problem. My organization uses Mcafee 8.5i. Does that have to do
with anything? Here's my code:
<system.net>
<mailSettings>
<smtp>
<network host="10.162.22.72" />
</smtp>
</mailSettings>
</system.net>
Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SendEmail.Click
Const ToAddress As String = "some...@somewhere.com"
Dim mm As New MailMessage(UsersEmail.Text, ToAddress)
mm.Subject = Subject.Text
mm.Body = Body.Text
mm.IsBodyHtml = False
Dim smtp As New SmtpClient
smtp.Send(mm)
End Sub
In the <network host.. /section, I did not specify a username and
password because I set the smtp server authentication mode is set to
Anonymous Access. Can someone please tell me what I did wrong? I
couldn't find anything on the Web that could point me in the right
direction.
Thanks,
Jon

Sep 6 '07 #8
On Sep 6, 5:40 am, "Kevin Spencer" <unclechut...@nothinks.comwrote:
The problem is almost certainly one of security. SMTP is a network protocol
that uses a specific TCP port (usually 25) to send a message from a client
application to an SMTP server. The SMTP server then sends the message to the
end recipient, usually a POP3 server like Exchange. There are many security
issues involved. First, the SMTP server must be configured correctly to
allow the client to send a message to it. This involves configuring the
Authentication correctly on the SMTP server, and the client using the
correct Authentication method to connect. It also involves configuring Relay
permissions correctly on the SMTP server.

If the SMTP server is not on the same machine as the client, it also
involves the network security between the machines on the network, whether
it is a private network or a public one. The IP address in your MailSetting
section indicates that the SMTP server is on a private network, and I will
assume that the client application is on a machine in the same private
network. Therefore, Firewall software on either the client machine or SMTP
server machine may need to be configured to allow the SMTP traffic.

Assuming that the messages is received by the SMTP server, the SMTP server
can be configured to send the message by any of several means. Inside a
private network, this generally requires that the SMTP server be mapped to a
public IP address using NAT (Network Address Translation), or that it be
configured to use another SMTP server as a "Smart Host." If the SMTP server
has a public IP address, it must be allowed by the network Firewall to pass
the message through. If it uses a Smart Host, the Smart Host must be
configured to allow messages from the client SMTP server, and allowed by the
network Firewall to pass the message through.

I hope you have a network administrator handy to help you figure out what
the problem is.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:http://www.miradyne.net

"Homer" <HomerS...@gmail.comwrote in message

news:11*********************@r29g2000hsg.googlegro ups.com...
Hi,
I've posted this question before but didn't get anywhere with it.
Please help me out if you know of a solution for it.
I got "InnerException: Unable to connect to remote server"..."No
connection could be made because the target machine actively refused
it" when I attempted to send an email through my Intranet app that is
written in asp.net 2.0. The smtp server is a local server and it uses
Port 25. The Authentication is set to Anonymous Access. I tried
pointing to the SMTP gateway on my Exchange server and I ran into the
same problem. My organization uses Mcafee 8.5i. Does that have to do
with anything? Here's my code:
<system.net>
<mailSettings>
<smtp>
<network host="10.162.22.72" />
</smtp>
</mailSettings>
</system.net>
Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SendEmail.Click
Const ToAddress As String = "some...@somewhere.com"
Dim mm As New MailMessage(UsersEmail.Text, ToAddress)
mm.Subject = Subject.Text
mm.Body = Body.Text
mm.IsBodyHtml = False
Dim smtp As New SmtpClient
smtp.Send(mm)
End Sub
In the <network host.. /section, I did not specify a username and
password because I set the smtp server authentication mode is set to
Anonymous Access. Can someone please tell me what I did wrong? I
couldn't find anything on the Web that could point me in the right
direction.
Thanks,
Jon- Hide quoted text -

- Show quoted text -
My organization uses Mcafee 8.5i and when I unchecked "block" on "mass
mailing..." I was able to send send messages through. I found a
suggestion from McAfee to add "W3wp.exe" to the exclusion list of port
25 but that turned out to be a dud. I finally unchecked the block and
it worked. I have to check with my ePO guy to see if there is any
security risk in unblocking port 25 altogether.

Thank you everybody for your invaluable help. Please keep the
suggestion coming. The more suggestions I get the more options I have
to explore.

Jon

Sep 6 '07 #9
"Homer" <Ho*******@gmail.comwrote in message
news:11**********************@22g2000hsm.googlegro ups.com...
My organization uses Mcafee 8.5i and when I unchecked "block" on "mass
mailing..." I was able to send send messages through.
Yes indeed.
I found a suggestion from McAfee to add "W3wp.exe" to the exclusion list
of port
25 but that turned out to be a dud.
Curious. I have a client with that exact same issue, and adding w3wp.exe in
"Access Protection Properties" fixed it...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Sep 6 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: RMG | last post by:
System.Web.Mail.SmtpMail appears to rely upon CDO. Such code therefore works fine on my development box which has Outlook 200 installed. But when the application is deployed to the production...
1
by: Sean | last post by:
Hi all, I have two databases set up, one for development and one for production. They are almost identical. I noticed that a query was taking about 6.7 seconds to execute on the development...
2
by: Marc | last post by:
Here is a new error I am getting. I have a development computer (Server 2000, SQL2000, .NET 1.1) I have a production computer (Server 2003, SQL2000, .NET 1.1) When I run my solution on the...
3
by: Marc | last post by:
Here is a new error I am getting. I have a development computer (Server 2000, SQL2000, .NET 1.1) I have a production computer (Server 2003, SQL2000, .NET 1.1) When I run my solution on the...
3
by: Imran Aziz | last post by:
Hello All, I am getting the following error on our production server, and I dont get the same error on the development box. Unable to cast object of type 'System.Byte' to type 'System.String'. ...
5
by: rogsonl | last post by:
My computer was moved last week, and the company changed the network groups we work on. As a result, one of the main benefits from Whidbey (database connectivity) no longer works. Situation: 1....
2
by: Rossco | last post by:
I have a VB.NET serviced component (COM+), running on a lan, that calls out to an external web service to place an order with a supplier. The problem machine is the middle tier (COM+) for our in...
2
by: antonyliu2002 | last post by:
I am testing AJAX. I've downloaded the AJAX Extension and the CTP December package and installed on BOTH my development machine and the production server. Then I created a very very simple web...
5
by: mivey4 | last post by:
Hi, First off, I am aware that this is a very heavily documented error and I have done my homework for throughly researching probable causes before deciding to post my problem here. At this point,...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.