Leantime / leantime

Leantime is a goals focused project management system for non-project managers. Building with ADHD, Autism, and dyslexia in mind.
https://leantime.io
GNU Affero General Public License v3.0
4.74k stars 597 forks source link

[Bug]: SMTP seems not to be working #2763

Closed michaelortnerit closed 3 weeks ago

michaelortnerit commented 3 weeks ago

What is your set up?

Self Hosted Docker

Version

3.2.1

Describe the issue

  1. I try to setup smtp with microsoft smtp relay. But i don't reseve an email for example for the invite of a new user. I get an error in the logs. Maybe i have configured something wrong.

Configuration ENV Docker:

  - LEAN_EMAIL_RETURN='user@domain.at'

  - LEAN_EMAIL_USE_SMTP=true
  - LEAN_EMAIL_SMTP_HOST='domain-at.mail.protection.outlook.com'
  - LEAN_EMAIL_SMTP_PORT='25'
  - LEAN_EMAIL_SMTP_AUTH=false
  - LEAN_EMAIL_SMTP_AUTO_TLS=true
  - LEAN_EMAIL_SMTP_SECURE='TLS'
  - LEAN_EMAIL_SMTP_SSLNOVERIFY=false

 Maybe i forogot something or configured something wrong? Help will be nice :)

Reproduction steps

  1. Configure SMTP via Environments
  2. Restarted Docker Container
  3. Try to invite a new user

Additional Notes

Error:

[2024-10-29 09:24:27] production.ERROR: foreach() argument must be of type array|object, null given {"exception":"[object] (ErrorException(code: 0): foreach() argument must be of type array|object, null given at /var/www/html/vendor/illuminate/collections/Arr.php:255) [stacktrace]

0 /var/www/html/app/Core/Exceptions/HandleExceptions.php(255): Leantime\Core\Exceptions\HandleExceptions->handleError(2, 'foreach() argum...', '/var/www/html/v...', 255)

1 /var/www/html/vendor/illuminate/collections/Arr.php(255): Leantime\Core\Exceptions\HandleExceptions->Leantime\Core\Exceptions\{closure}(2, 'foreach() argum...', '/var/www/html/v...', 255)

2 /var/www/html/app/Core/Console/ConsoleKernel.php(154): Illuminate\Support\Arr::flatten(NULL)

3 /var/www/html/app/Core/Console/ConsoleKernel.php(36): Leantime\Core\Console\ConsoleKernel->commands()

4 /var/www/html/app/Core/Console/ConsoleKernel.php(253): Leantime\Core\Console\ConsoleKernel->bootstrap()

5 /var/www/html/app/Domain/Cron/Controllers/Run.php(60): Leantime\Core\Console\ConsoleKernel->call('schedule:run', Array, Object(Symfony\Component\Console\Output\BufferedOutput))

6 /var/www/html/app/Core/Events/EventDispatcher.php(470): Leantime\Domain\Cron\Controllers\Run->Leantime\Domain\Cron\Controllers\{closure}(Array)

7 /var/www/html/app/Core/Events/EventDispatcher.php(74): Leantime\Core\Events\EventDispatcher::executeHandlers(Array, 'events', 'leantime.core.h...', Array)

8 /var/www/html/app/Core/Events/DispatchesEvents.php(28): Leantime\Core\Events\EventDispatcher::dispatch_event('leantime.core.h...', Array, 'leantime.core.h...')

9 /var/www/html/app/Core/Http/HttpKernel.php(109): Leantime\Core\Http\HttpKernel::dispatch_event('request_termina...', Array)

10 /var/www/html/app/Core/Bootstrap/Bootloader.php(154): Leantime\Core\Http\HttpKernel->terminate(Object(Leantime\Core\Http\IncomingRequest), Object(Symfony\Component\HttpFoundation\Response))

11 /var/www/html/app/Core/Bootstrap/Bootloader.php(129): Leantime\Core\Bootstrap\Bootloader->handleRequest()

12 /var/www/html/public/index.php(13): Leantime\Core\Bootstrap\Bootloader->boot()

13 {main}

"} [2024-10-29 09:24:27] production.INFO: Command Output:
[2024-10-29 09:24:27] production.INFO: Cron run finished
[2024-10-29 02:24:28] production.CRITICAL: 4 Invalid address: (From): 'user@domain.at'
[2024-10-29 02:24:28] production.CRITICAL: 4 Invalid hostentry:
[2024-10-29 02:24:28] production.CRITICAL: 4 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

michaelortnerit commented 3 weeks ago

So i have checked again and see that i have set the environment "LEAN_EMAIL_SMTP_HOST='domain-at.mail.protection.outlook.com'. But it should be LEAN_EMAIL_SMTP_HOSTS='domain-at.mail.protection.outlook.com'

I tested it again, but same error:

[2024-10-29 02:39:57] production.CRITICAL: 4 Invalid address: (From): 'user@domain.at'
[2024-10-29 02:39:57] production.CRITICAL: 4 Invalid host: 'domain-at.mail.protection.outlook.com'
[2024-10-29 02:39:57] production.CRITICAL: 4 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

michaelortnerit commented 3 weeks ago

I found the issue it looks like it does not accept following: ' ' so i removed this and now working :D