Try to connect to the server via Telnet to verify you can get to the port outside of your application.
Try opening up a command prompt, typing "telnet", then in telnet, type the following:
open <ip or address of server> 25
This should attempt to open a connection on port 25 (assuming that the server is using a standard SMTP port), if you get a bit of text welcoming you, then the mail server is fine - if on the other hand, you get something like "connection refused", then it's a server problem, rather than a code problem.
Does your SMTP server need authentication? Outlook might connect, but it could be using authentication prior to connecting.
Also, do you have a proxy or firewall in the picture.
This is bcoz of the antivirus which is blocked by the windows firewall,
just add the antivirus to the windows firewall ,in windows firewall Exception tab -->AddProgram and select the antivirus which is installed in your system .. this will solve the prob for ASP.net application ..
The problem is our virus scanner doing the blocking.
We run McAfee version 8 and so our infrastructure people are looking at the problem now to create a rule to allow Smtp traffic out of developer boxes.
The solution to it is Open McAfee Virusscan console. Double click Access Protection, Select the first rule corresponding to port 25 (default smtp port). Double click on it, in the excluded processes list you would see that inetinfo.exe is present. This was for iis5.0 and iis5.1, the asp.net 2.0 worker process runs as w3wp.exe. Thus add w3wp.exe to the process list and you should be able to get it running.
If you're running VS.NET 2005 and your web application is using the ASP.NET Development Server (instead of IIS), the process name to add to the excluded processes list is: WebDev.WebServer.exe.
Thanks for the advice so far, it allowed me to track my similar problem. I checked the McAfee log and found that it was my aspnet_wp.exe process that was being blocked (VS2005). I added that to the list and all works
REF:
http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework.windowsforms/topic4464.aspx
http://social.msdn.microsoft.com/forums/en-US/netfxnetcom/thread/17e3f2c9-c3f8-4531-b251-11fafe46ec14/
http://social.msdn.microsoft.com/forums/en-US/netfxnetcom/thread/212feb8f-cf96-4561-9953-40a21d21ea47/
http://forums.asp.net/t/1209181.aspx
http://www.isaserver.org/articles/smtprelayinboundoutbound.html
http://www.zoneedit.com/smtp.html