Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot use smtpclient to send mail with localhost iis site
    primarykey
    data
    text
    <p>I have an asp.net 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?</p> <pre><code>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(); mailClient.Send(message); } </code></pre> <p>Here is the exception:</p> <pre><code>{System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:25 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&amp; socket, IPAddress&amp; address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception&amp; exception)} </code></pre> <p>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:</p> <p>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.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload