Email not working after updating to latest version

Version v5.10.59-L158

Environment Dedicated hosting

Checklist

  • Can you replicate the issue on our v5 demo site https://demo.invoiceninja.com or Invoice Ninja? no
  • Have you searched existing issues? yes, could not find anything
  • Have you inspected the logs in storage/logs/laravel.log for any errors? yes

Describe the bug

Since the latest update, the email functionality isn’t working anymore.
I didn’t change anything from my side.

Steps To Reproduce

Try to send invoice or test the email settings.

Expected Behavior

Send the email.

Additional context

This problem also caused the status of an invoice to be set incorrectly to viewed.
But maybe this is because I commented some code so that I could proceed for now until there is a root cause. For clarity, all email settings are configured correctly and nothing has been changed lately.

I edited file vendor/symfony/mailer/Transport/Smtp/EsmtpTransportFactory.php and changed below:

final class EsmtpTransportFactory extends AbstractTransportFactory
{
    public function create(Dsn $dsn): TransportInterface
    {
        /**if (!\in_array($dsn->getScheme(), $this->getSupportedSchemes(), true)) {
            throw new UnsupportedSchemeException($dsn, 'smtp', $this->getSupportedSchemes());
    }**/

Screenshots

Logs

[2024-12-04 15:14:46] production.ERROR: The "" scheme is not supported; supported schemes for mailer "smtp" are: "smtp", "smtps". {"userId":1,"exception":"[object] (Symfony\\Component\\Mailer\\Exception\\UnsupportedSchemeException(code: 0): The \"\" scheme is not supported; supported schemes for mailer \"smtp\" are: \"smtp\", \"smtps\". at /var/www/vendor/symfony/mailer/Transport/Smtp/EsmtpTransportFactory.php:28)
[stacktrace]
#0 /var/www/vendor/laravel/framework/src/Illuminate/Mail/MailManager.php(202): Symfony\\Component\\Mailer\\Transport\\Smtp\\EsmtpTransportFactory->create()
#1 /var/www/vendor/laravel/framework/src/Illuminate/Mail/MailManager.php(181): Illuminate\\Mail\\MailManager->createSmtpTransport()
#2 /var/www/vendor/laravel/framework/src/Illuminate/Mail/MailManager.php(146): Illuminate\\Mail\\MailManager->createSymfonyTransport()
#3 /var/www/vendor/laravel/framework/src/Illuminate/Mail/MailManager.php(123): Illuminate\\Mail\\MailManager->build()
#4 /var/www/vendor/laravel/framework/src/Illuminate/Mail/MailManager.php(101): Illuminate\\Mail\\MailManager->resolve()
#5 /var/www/vendor/laravel/framework/src/Illuminate/Mail/MailManager.php(79): Illuminate\\Mail\\MailManager->get()
#6 /var/www/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(358): Illuminate\\Mail\\MailManager->mailer()
#7 /var/www/app/Services/Email/Email.php(268): Illuminate\\Support\\Facades\\Facade::__callStatic()
#8 /var/www/app/Services/Email/Email.php(121): App\\Services\\Email\\Email->email()
#9 /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Services\\Email\\Email->handle()
#10 /var/www/vendor/laravel/framework/src/Illuminate/Container/Util.php(43): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#11 /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(95): Illuminate\\Container\\Util::unwrapIfClosure()
#12 /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#13 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(694): Illuminate\\Container\\BoundMethod::call()
#14 /var/www/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(126): Illuminate\\Container\\Container->call()
#15 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}()
#16 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#17 /var/www/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(130): Illuminate\\Pipeline\\Pipeline->then()
#18 /var/www/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(124): Illuminate\\Bus\\Dispatcher->dispatchNow()
#19 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Queue\\CallQueuedHandler->Illuminate\\Queue\\{closure}()
#20 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#21 /var/www/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(123): Illuminate\\Pipeline\\Pipeline->then()
#22 /var/www/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(71): Illuminate\\Queue\\CallQueuedHandler->dispatchThroughMiddleware()
#23 /var/www/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(102): Illuminate\\Queue\\CallQueuedHandler->call()
#24 /var/www/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php(76): Illuminate\\Queue\\Jobs\\Job->fire()
#25 /var/www/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php(56): Illuminate\\Queue\\SyncQueue->executeJob()
#26 /var/www/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(244): Illuminate\\Queue\\SyncQueue->push()
#27 /var/www/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(228): Illuminate\\Bus\\Dispatcher->pushCommandToQueue()
#28 /var/www/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(77): Illuminate\\Bus\\Dispatcher->dispatchToQueue()
#29 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Bus/PendingDispatch.php(205): Illuminate\\Bus\\Dispatcher->dispatch()
#30 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Bus/Dispatchable.php(19): Illuminate\\Foundation\\Bus\\PendingDispatch->__destruct()
#31 /var/www/app/Http/Controllers/EmailController.php(91): App\\Services\\Email\\Email::dispatch()
#32 /var/www/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php(257): App\\Http\\Controllers\\EmailController->App\\Http\\Controllers\\{closure}()
#33 /var/www/app/Http/Controllers/EmailController.php(83): Illuminate\\Support\\Collection->each()
#34 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\\Http\\Controllers\\EmailController->send()
#35 /var/www/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(43): Illuminate\\Routing\\Controller->callAction()
#36 /var/www/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Tracing/Routing/TracingControllerDispatcherTracing.php(21): Illuminate\\Routing\\ControllerDispatcher->dispatch()
#37 /var/www/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Tracing/Routing/TracingRoutingDispatcher.php(18): Sentry\\Laravel\\Tracing\\Routing\\TracingControllerDispatcherTracing->Sentry\\Laravel\\Tracing\\Routing\\{closure}()
#38 /var/www/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Tracing/Routing/TracingControllerDispatcherTracing.php(20): Sentry\\Laravel\\Tracing\\Routing\\TracingRoutingDispatcher->wrapRouteDispatch()
#39 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Route.php(265): Sentry\\Laravel\\Tracing\\Routing\\TracingControllerDispatcherTracing->dispatch()
#40 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Route.php(211): Illuminate\\Routing\\Route->runController()
#41 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php(808): Illuminate\\Routing\\Route->run()
#42 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}()
#43 /var/www/app/Http/Middleware/UserVerified.php(40): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#44 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): App\\Http\\Middleware\\UserVerified->handle()
#45 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(124): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#46 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(89): Illuminate\\Routing\\Middleware\\ThrottleRequests->handleRequestUsingNamedLimiter()
#47 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Routing\\Middleware\\ThrottleRequests->handle()
#48 /var/www/app/Http/Middleware/QueryLogging.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#49 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): App\\Http\\Middleware\\QueryLogging->handle()
#50 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(51): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#51 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle()
#52 /var/www/app/Http/Middleware/Locale.php(95): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#53 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): App\\Http\\Middleware\\Locale->handle()
#54 /var/www/app/Http/Middleware/TokenAuth.php(102): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#55 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): App\\Http\\Middleware\\TokenAuth->handle()
#56 /var/www/app/Http/Middleware/SetDb.php(40): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#57 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): App\\Http\\Middleware\\SetDb->handle()
#58 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#59 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php(807): Illuminate\\Pipeline\\Pipeline->then()
#60 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php(786): Illuminate\\Routing\\Router->runRouteWithinStack()
#61 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php(750): Illuminate\\Routing\\Router->runRoute()
#62 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php(739): Illuminate\\Routing\\Router->dispatchToRoute()
#63 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(201): Illuminate\\Routing\\Router->dispatch()
#64 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}()
#65 /var/www/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Http/FlushEventsMiddleware.php(13): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#66 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Sentry\\Laravel\\Http\\FlushEventsMiddleware->handle()
#67 /var/www/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Http/SetRequestIpMiddleware.php(45): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#68 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Sentry\\Laravel\\Http\\SetRequestIpMiddleware->handle()
#69 /var/www/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Http/SetRequestMiddleware.php(31): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#70 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Sentry\\Laravel\\Http\\SetRequestMiddleware->handle()
#71 /var/www/vendor/livewire/livewire/src/Features/SupportDisablingBackButtonCache/DisableBackButtonCacheMiddleware.php(19): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#72 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Livewire\\Features\\SupportDisablingBackButtonCache\\DisableBackButtonCacheMiddleware->handle()
#73 /var/www/app/Http/Middleware/Cors.php(24): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#74 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): App\\Http\\Middleware\\Cors->handle()
#75 /var/www/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(58): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#76 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\TrustProxies->handle()
#77 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#78 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#79 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle()
#80 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#81 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(51): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#82 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle()
#83 /var/www/vendor/laravel/framework/src/Illuminate/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#84 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\ValidatePostSize->handle()
#85 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(110): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#86 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle()
#87 /var/www/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Tracing/Middleware.php(79): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#88 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Sentry\\Laravel\\Tracing\\Middleware->handle()
#89 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#90 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\\Pipeline\\Pipeline->then()
#91 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(145): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
#92 /var/www/public/index.php(56): Illuminate\\Foundation\\Http\\Kernel->handle()
#93 {main}
"} 

Hi,

This should be resolved in the latest release.

Hi Hillel,

Today I installed the latest update, but unfortunately this didn’t solve the issue.
I’m still getting the same error message:

400: Bad Request • The “” scheme is not supported; supported schemes for mailer “smtp” are: “smtp”, “smtps”.

I find that strange because I checked the commit from David and according to the code it should set a default value “smtp” for the scheme if the environment variable has not been set. I tried changing this to smtps, but with the same result. Any thoughts?

Thanks for trying it, I suggest asking in a discussion on GitHub.

I update to 5.10.60 and have the same problem sending emails, with the error: 400: Bad Request • The “” scheme is not supported; supported schemes for mailer “smtp” are: “smtp”, “smtps”.

Feel free to follow up here:

use http://ninja.url/update?secret=( your secret can be found in .env file
and use health check and clear cache, after that emails worked fine

Unfortunatly that didn’t solve the issue.