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.smtp2go.com',
  '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 @.com',

Enable debug mode:

https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/email_configuration.html#enabling-debug-mode

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

"mail_smtpsecure" => '',

https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/email_configuration.html#smtp

SSL disabling did not help.

[core] Debug: Symfony\Component\Mailer\Exception\TransportException: Connection could not be established with host "mail.smtp2go.com:25": stream_socket_client(): Unable to connect to mail.smtp2go.com:25 (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
    stream_socket_client()
 2. /var/www/nextcloud/3rdparty/symfony/mailer/Transport/Smtp/SmtpTransport.php line 251
    Symfony\Component\Mailer\Transport\Smtp\Stream\SocketStream->initialize()
 3. /var/www/nextcloud/3rdparty/symfony/mailer/Transport/Smtp/SmtpTransport.php line 194
    Symfony\Component\Mailer\Transport\Smtp\SmtpTransport->start()
 4. /var/www/nextcloud/3rdparty/symfony/mailer/Transport/AbstractTransport.php line 72
    Symfony\Component\Mailer\Transport\Smtp\SmtpTransport->doSend()
 5. /var/www/nextcloud/3rdparty/symfony/mailer/Transport/Smtp/SmtpTransport.php line 136
    Symfony\Component\Mailer\Transport\AbstractTransport->send()
 6. /var/www/nextcloud/3rdparty/symfony/mailer/Mailer.php line 45
    Symfony\Component\Mailer\Transport\Smtp\SmtpTransport->send()
 7. /var/www/nextcloud/lib/private/Mail/Mailer.php line 216
    Symfony\Component\Mailer\Mailer->send()
 8. /var/www/nextcloud/apps/settings/lib/Controller/MailSettingsController.php line 168
    OC\Mail\Mailer->send()
 9. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 230
    OCA\Settings\Controller\MailSettingsController->sendTestMail()
10. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 137
    OC\AppFramework\Http\Dispatcher->executeController()
11. /var/www/nextcloud/lib/private/AppFramework/App.php line 183
    OC\AppFramework\Http\Dispatcher->dispatch()
12. /var/www/nextcloud/lib/private/Route/Router.php line 315
    OC\AppFramework\App::main()
13. /var/www/nextcloud/lib/base.php line 1068
    OC\Route\Router->match()
14. /var/www/nextcloud/index.php line 36
    OC::handleRequest()

POST /index.php/settings/admin/mailtest
from 192.168.1.192 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 mail.smtp2go.com.

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:

https://www.smtp2go.com/setup/

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.