Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Justin 1 post 71 karma points
    Oct 24, 2017 @ 21:39
    Justin
    0

    No connection could be made because the target machine actively refused it 127.0.0.1:25

    I am trying to set up SMTP for a client of mine's Umbraco 7.7 website.

    The forms were built using the UmbracoForms plugin and everything seems to be fine on that side of things. The workflow is created and set to send the email to my email address.

    I'm running the website localhost and I do not have a license. (I've read that you can run localhost if you do not have a license. Please correct me if i'm wrong)

    I went into the web.config and added the client's SMTP settings and the form did not appear to send.

    I went into the Log files and saw that I am receiving this error:

    *System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:25*
    

    I then tried to switch over to our personal SMTP credentials that I am 100% sure work, and I am receiving the same error.

    I cannot even receive an email from the "Forgot your Password" link on the login page.

    I checked our mailgun logs, and it looks like it never even made it there.

    Here are the SMTP credentials that I added to the web.config:

    <system.net>
        <mailSettings>
          <smtp from="Test@test.me">
            <network host="smtp.mailgun.org" port="25" userName="***@test.me" password="****" defaultCredentials="false" />
          </smtp>
        </mailSettings>
      </system.net>
    

    I even added my from email to the umbracoSettings.config file like this:

    <notifications>
      <!-- the email that should be used as from mail when umbraco sends a notification -->
      <email>Test@test.me</email>
    </notifications>
    

    Here is the full error that I am receiving in the log file.

    2017-10-24 16:27:35,135 [P16856/D4/T45] ERROR Umbraco.Forms.Core.Providers.WorkflowTypes.SendRazorEmail - There was a problem sending a Razor email to 'myEmail@myDomain.com' from Workflow for Form 'Contact Form' with id '0f36c378-bf45-44b2-8ce3-fcd4057b2a3a' for Record with unique id '03715450-5edd-4b5b-8443-ee16600b9db0'
    System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> 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.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
       --- End of inner exception stack trace ---
       at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6)
       at System.Net.PooledStream.Activate(Object owningObject, Boolean async, GeneralAsyncDelegate asyncCallback)
       at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback)
       at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout)
       at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)
       at System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint)
       at System.Net.Mail.SmtpClient.GetConnection()
       at System.Net.Mail.SmtpClient.Send(MailMessage message)
       --- End of inner exception stack trace ---
       at System.Net.Mail.SmtpClient.Send(MailMessage message)
       at Umbraco.Forms.Core.Providers.WorkflowTypes.SendRazorEmail.Execute(Record record, RecordEventArgs e)
    

    Any guidance would be greatly appreciated!

    Thank You

  • EJS 6 posts 89 karma points
    Oct 25, 2017 @ 10:34
    EJS
    0

    On the second line of the message in your logfile, it reads ‘127.0.0.1:25’. That means you’re still trying on localhost (which is 127.0.0.1). Probably you haven’t saved the web.config file after changing it... Or you have to restart your local application. By the way: I got the same error message when trying to connect to the SendGrid smtp service (smtp.sendgrid.net). This appeared to be a problem with using port 25: despite their documentation only port 587 could be used. Hth

  • linehammer 2 posts 72 karma points
    Jan 22, 2020 @ 04:42
    linehammer
    0

    This exception message says you're trying to connect to the same host ( 127.0.0.1 ), while you're stating that your server is running on a different host. This 127.0.0.1 represents a 'loopback' . It allows the computer to communicate with itself via network protocol .

    Dns.GetHostEntry(IPAddress.Loopback).HostName returns the host name of your machine. When you pass a host name to TcpClient , it will resolve it to one or more IP addresses using Dns.GetHostAddresses(hostName) . This includes the public and local IP addresses of your machine (e.g. 192.168.12.10), but not 127.0.0.1 (loopback address). So your client is trying to connect to any of the non-loopback addresses of your machine, while your server is listening only on the loopback address . So, no connection can be established. The solution to this problem is that connect to the same end point your server is listening on.

Please Sign in or register to post replies

Write your reply to:

Draft