SMTP configuration with smtp2go

Nextcloud version (eg, 20.0.5): Nextcloud Hub 6 (27.1.3)
Operating system and version (eg, Ubuntu 20.04): debian bookworm
Apache or nginx version (eg, Apache 2.4.25): turnkeylinux
PHP version (eg, 7.4): turnkeylinux

Is this the first time you’ve seen this error? (Y/N): Y

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_smtphost' => '',
  'mail_smtpport' => '25',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'ThisIsTheSMTPUserICreatedonsmtp2go',
  'mail_smtppassword' => 'SMTP2goUserPassword',
  'mail_smtpsecure' => 'ssl',
  'mail_from_address' => 'TeamMemberUsernamebeforethe@',
  'mail_domain' => '...domain name after the',

Enable debug mode:

A quick look suggests you probably do not want SSL mode:

"mail_smtpsecure" => '',

SSL disabling did not help.

[core] Debug: Symfony\Component\Mailer\Exception\TransportException: Connection could not be established with host "": stream_socket_client(): Unable to connect to (Connection timed out) at <<closure>>

 0. <<closure>>
    Symfony\Component\Mailer\Transport\Smtp\Stream\SocketStream->Symfony\Component\Mailer\Transport\Smtp\Stream\{closure}("*** sensitive parameters replaced ***")
 1. /var/www/nextcloud/3rdparty/symfony/mailer/Transport/Smtp/Stream/SocketStream.php line 157
 2. /var/www/nextcloud/3rdparty/symfony/mailer/Transport/Smtp/SmtpTransport.php line 251
 3. /var/www/nextcloud/3rdparty/symfony/mailer/Transport/Smtp/SmtpTransport.php line 194
 4. /var/www/nextcloud/3rdparty/symfony/mailer/Transport/AbstractTransport.php line 72
 5. /var/www/nextcloud/3rdparty/symfony/mailer/Transport/Smtp/SmtpTransport.php line 136
 6. /var/www/nextcloud/3rdparty/symfony/mailer/Mailer.php line 45
 7. /var/www/nextcloud/lib/private/Mail/Mailer.php line 216
 8. /var/www/nextcloud/apps/settings/lib/Controller/MailSettingsController.php line 168
 9. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 230
10. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 137
11. /var/www/nextcloud/lib/private/AppFramework/App.php line 183
12. /var/www/nextcloud/lib/private/Route/Router.php line 315
13. /var/www/nextcloud/lib/base.php line 1068
14. /var/www/nextcloud/index.php line 36

POST /index.php/settings/admin/mailtest
from by admin at 2023-11-06T20:58:38+00:00

That error would seem to indicate your server lacks outbound connectivity sufficient to reach port 25 on

What happens from your server/app container if you try to connect to that SMTP host from the command line?

This is on a VirtualBox machine with bridged network. Could that be the cause? It was able to download updates.

How do I test smtp connectivity from root terminal? Ping something? I think I also read someone saying it could be a timeout timelimit issue so I wonder if increasing that will help. I guess we’ll find out once I can test with a ping or whatever command you want me to try to run from terminal.

Maybe. Or port 25 is blocked.

There are numerous ways to test. It’ll depend on what’s installed in your OS and/or what can be installed readily. Your favorite search engine is your friend.

Common examples of tools that let you test with arbitrary ports: telnet,nc, and ncat.

And, yes, there’s a timeout parameter on those docs I previously linked to.

P.S. You could also try alternative ports supported by smtp2go:

I just changed it to be 2525 TLS and it worked all of a sudden. How strange.

1 Like

Many ISPs are blocking port 25 by default in order to prevent people from sending spam.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.