Version 5.9.4 C160
Environment: Ubuntu Server - un-tared TAR file and set up directly on host OS
I just discovered that on company B, none of my clients paid because both companies use the same SMTP email address. Company B customers were expecting emails from the domain corresponding to Company B, not Company A and probably thought it was spam. I have different domains and SMTP servers for Company A and B.
I saw this was asked for back in 2016. Is there currently a way to have Company A and Company B use different SMTP server configs?
Thank you.
Hi,
In the latest version of the app you can configure the SMTP settings on Settings > Email Settings.
Thank you. I don’t think I have the latest version (v5.9.4-C160) but I found Settings → Email. I went to company B, modified the SMTP user account but it still seems to be sending from the 1st company’s email account. Specifically, both companies send from the same SMTP user account but the friendly name received in test email shows Company A or Company B. It seems that it uses the same email account for both companies.
I suggest testing with the latest version of the app.
maybe you use in your config (docker config.yaml maybe?) the mail setup… remove the mail infos from the config file and use the mail settings from the homepage > settings >email settings… this works for me fine… (i use docker)
I now have the latest version and the same behavior persists.
I’m not using docker. I used composer to download it, which I believe is a one time thing? I checked the .env
file but I found no email server references. Are there any other config files?
Have you configured SMTP settings in the app for both companies?
I do not use the applications. I only use the web UI.
hillel
June 8, 2025, 5:09pm
10
By ‘app’ I meant ‘web app’
Have you configured settings for both companies?
You may also want to try removing the .env settings
Yes, I have specified unique settings for both companies.
I tried renaming the .env
file to .env.bak
, then I restarted nginx.
The website shows:
500 — Server Error
Check storage/logs for more details
This is the recent part of the log:
[2025-06-14 19:53:20] production.ERROR: No application encryption key has been specified. {"exception":"[object] (Illuminate\\Encryption\\MissingAppKeyException(code: 0): No application encryption key has been specified. at /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php:83)
[stacktrace]
#0 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Support/helpers.php(399): Illuminate\\Encryption\\EncryptionServiceProvider->Illuminate\\Encryption\\{closure}()
#1 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php(81): tap()
#2 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php(64): Illuminate\\Encryption\\EncryptionServiceProvider->key()
#3 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php(32): Illuminate\\Encryption\\EncryptionServiceProvider->parseKey()
#4 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(952): Illuminate\\Encryption\\EncryptionServiceProvider->Illuminate\\Encryption\\{closure}()
#5 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(832): Illuminate\\Container\\Container->build()
#6 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1078): Illuminate\\Container\\Container->resolve()
#7 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(763): Illuminate\\Foundation\\Application->resolve()
#8 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1058): Illuminate\\Container\\Container->make()
#9 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(1133): Illuminate\\Foundation\\Application->make()
#10 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(1043): Illuminate\\Container\\Container->resolveClass()
#11 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(994): Illuminate\\Container\\Container->resolveDependencies()
#12 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(832): Illuminate\\Container\\Container->build()
#13 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1078): Illuminate\\Container\\Container->resolve()
#14 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(763): Illuminate\\Foundation\\Application->resolve()
#15 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1058): Illuminate\\Container\\Container->make()
#16 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(198): Illuminate\\Foundation\\Application->make()
#17 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(127): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#18 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Routing/Router.php(807): Illuminate\\Pipeline\\Pipeline->then()
#19 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Routing/Router.php(786): Illuminate\\Routing\\Router->runRouteWithinStack()
#20 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Routing/Router.php(750): Illuminate\\Routing\\Router->runRoute()
#21 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Routing/Router.php(739): Illuminate\\Routing\\Router->dispatchToRoute()
#22 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(201): Illuminate\\Routing\\Router->dispatch()
#23 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(170): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}()
#24 /usr/share/nginx/invoiceninja/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Http/FlushEventsMiddleware.php(13): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#25 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(209): Sentry\\Laravel\\Http\\FlushEventsMiddleware->handle()
#26 /usr/share/nginx/invoiceninja/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Http/SetRequestIpMiddleware.php(45): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#27 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(209): Sentry\\Laravel\\Http\\SetRequestIpMiddleware->handle()
#28 /usr/share/nginx/invoiceninja/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Http/SetRequestMiddleware.php(31): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#29 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(209): Sentry\\Laravel\\Http\\SetRequestMiddleware->handle()
#30 /usr/share/nginx/invoiceninja/vendor/livewire/livewire/src/Features/SupportDisablingBackButtonCache/DisableBackButtonCacheMiddleware.php(19): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#31 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(209): Livewire\\Features\\SupportDisablingBackButtonCache\\DisableBackButtonCacheMiddleware->handle()
#32 /usr/share/nginx/invoiceninja/app/Http/Middleware/Cors.php(24): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#33 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(209): App\\Http\\Middleware\\Cors->handle()
#34 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(58): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#35 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(209): Illuminate\\Http\\Middleware\\TrustProxies->handle()
#36 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#37 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#38 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(209): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle()
#39 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#40 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(51): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#41 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(209): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle()
#42 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#43 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(209): Illuminate\\Http\\Middleware\\ValidatePostSize->handle()
#44 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(110): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#45 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(209): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle()
#46 /usr/share/nginx/invoiceninja/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Tracing/Middleware.php(79): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#47 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(209): Sentry\\Laravel\\Tracing\\Middleware->handle()
#48 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(127): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#49 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\\Pipeline\\Pipeline->then()
#50 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(145): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
#51 /usr/share/nginx/invoiceninja/public/index.php(56): Illuminate\\Foundation\\Http\\Kernel->handle()
#52 {main}
"}
[2025-06-14 19:53:20] production.INFO: To setup the app run: cp .env.example .env
[2025-06-14 19:53:20] production.ERROR: No application encryption key has been specified. {"exception":"[object] (Illuminate\\Encryption\\MissingAppKeyException(code: 0): No application encryption key has been specified. at /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php:83)
[stacktrace]
#0 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Support/helpers.php(399): Illuminate\\Encryption\\EncryptionServiceProvider->Illuminate\\Encryption\\{closure}()
#1 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php(81): tap()
#2 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php(64): Illuminate\\Encryption\\EncryptionServiceProvider->key()
#3 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php(32): Illuminate\\Encryption\\EncryptionServiceProvider->parseKey()
#4 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(952): Illuminate\\Encryption\\EncryptionServiceProvider->Illuminate\\Encryption\\{closure}()
#5 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(832): Illuminate\\Container\\Container->build()
#6 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1078): Illuminate\\Container\\Container->resolve()
#7 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(763): Illuminate\\Foundation\\Application->resolve()
#8 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1058): Illuminate\\Container\\Container->make()
#9 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(1133): Illuminate\\Foundation\\Application->make()
#10 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(1043): Illuminate\\Container\\Container->resolveClass()
#11 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(994): Illuminate\\Container\\Container->resolveDependencies()
#12 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(832): Illuminate\\Container\\Container->build()
#13 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1078): Illuminate\\Container\\Container->resolve()
#14 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(763): Illuminate\\Foundation\\Application->resolve()
#15 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1058): Illuminate\\Container\\Container->make()
#16 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(258): Illuminate\\Foundation\\Application->make()
#17 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(216): Illuminate\\Foundation\\Http\\Kernel->terminateMiddleware()
#18 /usr/share/nginx/invoiceninja/public/index.php(63): Illuminate\\Foundation\\Http\\Kernel->terminate()
#19 {main}
"}
[2025-06-14 19:53:20] production.INFO: To setup the app run: cp .env.example .env
[2025-06-14 19:53:21] production.ERROR: Uncaught ErrorException: Cannot modify header information - headers already sent by (output started at /usr/share/nginx/invoiceninja/vendor/symfony/http-foundation/Response.php:387) in /usr/share/nginx/invoiceninja/vendor/symfony/http-foundation/Response.php:322
Stack trace:
#0 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(256): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()
#1 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->Illuminate\Foundation\Bootstrap\{closure}()
#2 /usr/share/nginx/invoiceninja/vendor/symfony/http-foundation/Response.php(322): header()
#3 /usr/share/nginx/invoiceninja/vendor/symfony/http-foundation/Response.php(401): Symfony\Component\HttpFoundation\Response->sendHeaders()
#4 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(219): Symfony\Component\HttpFoundation\Response->send()
#5 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(196): Illuminate\Foundation\Bootstrap\HandleExceptions->renderHttpResponse()
#6 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(256): Illuminate\Foundation\Bootstrap\HandleExceptions->handleException()
#7 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->Illuminate\Foundation\Bootstrap\{closure}()
#8 {main}
thrown {"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Uncaught ErrorException: Cannot modify header information - headers already sent by (output started at /usr/share/nginx/invoiceninja/vendor/symfony/http-foundation/Response.php:387) in /usr/share/nginx/invoiceninja/vendor/symfony/http-foundation/Response.php:322
Stack trace:
#0 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(256): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()
#1 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}()
#2 /usr/share/nginx/invoiceninja/vendor/symfony/http-foundation/Response.php(322): header()
#3 /usr/share/nginx/invoiceninja/vendor/symfony/http-foundation/Response.php(401): Symfony\\Component\\HttpFoundation\\Response->sendHeaders()
#4 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(219): Symfony\\Component\\HttpFoundation\\Response->send()
#5 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(196): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->renderHttpResponse()
#6 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(256): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleException()
#7 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}()
#8 {main}
thrown at /usr/share/nginx/invoiceninja/vendor/symfony/http-foundation/Response.php:322)
[stacktrace]
#0 {main}
"}
I then restored the .env
file. I edited out all the email lines, which were populated with “” anyways (empty).
Then I went into the website, noticed at the top there was an icon for “Web App”. I went into that, which looks different than the web GUI I’m used to. I went to settings and specified SMTP Server B which corresponds to Company B.
Unfortunately, after all this, Company B still sends emails from the email server specified by Company A.
Also, I updated to v5.12.1 from within the GUI and the problem persists.
hillel
June 14, 2025, 8:59pm
13
@david do you have any suggestions?
david
June 14, 2025, 10:00pm
14
Sounds like a configuration of issues
So, no way to get this working? I just updated the software last night again but it’s still using the same SMTP server for both companies. If I delete the .env file, the entire website dies. It looks like self-hosted absolutely needs the .env file to specify network configurations such as working behind my reverse proxy. The .env file has no email server entries. What’s odd is that the email labels can be unique but the email server itself does not keep unique servers. It’s almost like the email servers are stored in an array and this software only reads from the first element of the array. I don’t really know what’s going on… I’m just making an analogy.
hillel
June 25, 2025, 7:26pm
16
What do you mean by “the email labels can be unique but the email server itself does not keep unique servers”?
The app should read the config set on Settings > Email Settings for each company. The .env file should only be used if there aren’t SMTP settings defined in the app.
What do you mean by “the email labels can be unique but the email server itself does not keep unique servers”?
When I visit the Email sections for each different company, I see different Company names but the server info appears to remain the same. When I receive test emails produced from the Company → Email section of each individual company, the email Header shows the different company names, but the origination email address used to send that message is always the same.
The app should read the config set on Settings > Email Settings for each company. The .env file should only be used if there aren’t SMTP settings defined in the app.
Yes. And every single time I change the server to make each company use a unique account, it seems to only ever keep a single email account used commonly between both companies.
My version: 5.12.6
Hosted: self hosted on Ubuntu 24.04 live server
Health Check = only “issue” is snappdf. I use Phantom… wish we could ignore “issues” that aren’t issues…
So I was curious about this… I only have one company and don’t want to deal with a mess so I made a snapshot and then added a ghost company for testing.
Real Company = SMTP settings are done and they work already (previously tested)
Untitled Company = Added different SMTP settings than anything on the real company so it’s a real test.
Test result: The “Send Test Email” button resulted in me receiving the “Email Server Works” and the from is the different SMTP from address.
Test send quote: Same as “Send Test Email”. I received the quote from the correct SMTP from address.
After this I went back to my real company and then sent a quote from the “old” SMTP settings… and that came in exactly as I expected and from the correct SMTP from address.
I think there’s something else going on in your instance since it’s working just fine for me.