Nextcloud Error - Sending Email To New Users - Swift_TransportException: could not be established with host 127.0.0.1

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version : 19.0.3
Operating system and version: LXC - Ubuntu18
Apache2.?
PHP version: 7.4

Originally I tried to use the registration app to allow my users to create their own username and password but I kept getting server errors. Alternatively I found out that I can create the user and leave the password blank and place their email for them to create the password. Problem is that the email never comes through and when I try to click on “send a welcome email” I get an error.

I already set up the webclient, I can read my emails and send them just fine but for some reason I can’t send them a welcome email or create a password email to them. I also made sure the box, “send email to user” is checked within the settings. Below is the error log, sadly I dont know enough PHP to know the real issue, I did try to look into it but was getting overwhelmed. I’m trying to cut some cost on my small business and do things myself but there’s only so much I can understand, any help/advice would be appreciated!

Additional Notes: I am running NC in a Ubuntu 18 LXC within my QNAP NAS

Is this the first time you’ve seen this error? YES

The output of your Nextcloud log in Admin > Logging:

	Swift_TransportException: Connection could not be established with host 127.0.0.1 :stream_socket_client(): unable to connect to 127.0.0.1:25 (Connection refused)

    <<closure>>

    Swift_Transport_StreamBuffer->{closure}("*** sensiti ... *")

    /var/www/html/nextcloud/3rdparty/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php - line 272:

    stream_socket_client()

    /var/www/html/nextcloud/3rdparty/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php - line 58:

    Swift_Transport_StreamBuffer->establishSocketConnection()

    /var/www/html/nextcloud/3rdparty/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php - line 143:

    Swift_Transport_StreamBuffer->initialize()

    /var/www/html/nextcloud/3rdparty/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php - line 65:

    Swift_Transport_AbstractSmtpTransport->start()

    /var/www/html/nextcloud/lib/private/Mail/Mailer.php - line 204:

    Swift_Mailer->send()

    /var/www/html/nextcloud/apps/settings/lib/Mailer/NewUserMailHelper.php - line 174:

    OC\Mail\Mailer->send()

    /var/www/html/nextcloud/apps/provisioning_api/lib/Controller/UsersController.php - line 971:

    OCA\Settings\Mailer\NewUserMailHelper->sendMail()

    /var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 170:

    OCA\Provisioning_API\Controller\UsersController->resendWelcomeMessage()

    /var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 100:

    OC\AppFramework\Http\Dispatcher->executeController()

    /var/www/html/nextcloud/lib/private/AppFramework/App.php - line 137:

    OC\AppFramework\Http\Dispatcher->dispatch()

    /var/www/html/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47:

    OC\AppFramework\App::main()

    <<closure>>

    OC\AppFramework\Routing\RouteActionHandler->__invoke()

    /var/www/html/nextcloud/lib/private/Route/Router.php - line 297:

    call_user_func()

    /var/www/html/nextcloud/ocs/v1.php - line 88:

    OC\Route\Router->match()

    /var/www/html/nextcloud/ocs/v2.php - line 24:

    require_once("/var/www/ht ... p")

Not sure if you need the config.php file to understand whats going.

Unfortunately you haven’t explained IN DETAIL how you’ve successfully set-up a webclient to send email. The error message “could not be established with host 127.0.0.1 … unable to connect to 127.0.01:25 (Connection refused)” is absolutely clear. Connections on the loopback device are not accepted on port 25/tcp.

Please EXPLAIN IN DETAIL how your settings are looking like, what you’ve tried with which result.

Hi thank you for responding!

By webclient I am referring to the Email App that NC comes with; so I set that up by simply following the prompts. I entered my email and the password, once it completed loading it pulled up my emails. Upon further inspecting it seems that I can only see emails that are received and get notified if I get a new email but I can not send emails from the Email App.

I looked at the settings and realized that I did not full set up my Email Server in Settings>Basic Settings>Email Server. After setting this up I was able to send the welcoming emails to users. So my main objective is fixed but I’m confused as to why I cant send emails form the Email App; currently the send button appears to be clouded?

So please describe IN DETAIL what you’ve entered in the fields or provide a screenshot of the settings. Please also show any displayed error message and any related error from the Nextcloud log file.