Cannot use smtpclient to send mail with localhost iis site

I have an mvc app running on a local iis website that is failing to send mail using SmtpClient from System.Net.Mail. I am trying to send a mail to my hotmail address and I get a socket exception. Any idea what the problem might be?

using(var message = new MailMessage())
                message.From = new MailAddress(AdminEmail);
                message.To.Add(new MailAddress(to));
                message.Subject = subject;
                message.Body = body;
                message.IsBodyHtml = false;

                var mailClient = new SmtpClient();

Here is the exception:

{System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)}

I think the default app pool does not have access to intepub\wwwroot. Here is the error that I get when trying to test the connection:

The server is configured to use pass-through authentication with a built-in account to access the specified physical path. However, IIS Manager cannot verify whether the built-in account has access. Make sure that the application pool identity has Read access to the physical path. If this server is joined to a domain, and the application pool identity is NetworkService or LocalSystem, verify that \$ has Read access to the physical path. Then test these settings again.


Based on your answers to my comments above Joe, you don't have SMTP enabled on your local machine. Vista does not come with SMTP.

As such, you'll either have to install a 3rd party SMTP app that will run on Vista, or use another app to send via, in this case, your Hotmail account may allow you to send outgoing via it. I don't use Hotmail so don't know if it will or not but it should be something like and your credentials. My primary account is a gmail account, so I can use it via and of course, my credentials.

Need Your Help

Best practices when using cookies

javascript cookies

I'm working on a javascript page using cookies and I was wondering if it is better to use a single cookie which contains multiple values stored in an object or a separate cookie for each value.

MAC OS X + stage.fullScreenSourceRect + renderMode set to GPU = wrong mouse position

actionscript-3 flash air flash-builder

When setting stage.fullScreenSourceRect, stage.displayState to StageDisplayState.FULL_SCREEN_INTERACTIVE; and renderMode to GPU, mouse position is read incorrectly. This is not only for mouseX and ...