Connection Refused Error When Sending Email

Discussion in 'ASP.NET / ASP.NET Core' started by syzygy, Mar 28, 2010.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I feel silly asking because it's been asked so many times before, but I just can't figure out what's up. I get the "No connection could be made because the target machine actively refused it 127.0.0.1:25" error when trying to send email through the site. I took my code fresh off of the sample page: https://my.discountasp.net/web-manager/iis7-recycleapp.aspx

    Relevant Web.config settings:
    Code:
        <system.net>
            <mailSettings>
                <smtp>
                    <network host="localhost" port="25" />
                </smtp>
            </mailSettings>
        </system.net>
    Here's the full stack trace:
    Code:
    [SocketException (0x274d): No connection could be made because the target machine actively refused it 127.0.0.1:25]
       System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +239
       System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +35
       System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +224
    
    [WebException: Unable to connect to the remote server]
       System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) +5482743
       System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) +202
       System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) +21
       System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) +332
       System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) +160
       System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) +159
       System.Net.Mail.SmtpClient.GetConnection() +35
       System.Net.Mail.SmtpClient.Send(MailMessage message) +1213
    
    [SmtpException: Failure sending mail.]
       System.Net.Mail.SmtpClient.Send(MailMessage message) +1531
       AdvancedCapitalGroup.contact_default2.Page_Load(Object sender, EventArgs e) in D:\Documents\AdvancedCapitalGroup\AdvancedCapitalGroup\contactacg\default2.aspx.vb:17
       System.Web.UI.Control.OnLoad(EventArgs e) +99
       System.Web.UI.Control.LoadRecursive() +50
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
    What am I missing here? I'm sure it's a facepalm situation. All ideas appreciated.

    Thanks,
    Adam
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page