Email settings can't be changed
Hello,
when i setup a Cachet and enter my Mailserver data, after finishing the process, the data is reset to default like "localhost"
If i once again change the data in the settings section and press "Save" it is again reset to default.
What can i do?
Best regards
Hi, are you sure you're hitting save? I also have this reset problem, but only when I hit the Test button.
I think i can read. The Button with "Save" on it, is the right one, yes?
Of course i am hitting the Save button....
I'm sorry if that sounded impolite. I didn't mean to offend you.
I just wasn't sure because I couldn't reproduce the problem. I only had the problem when I pressed the test button.
Now I have found the mistake on my side: After I entered the values and pressed save, I had to reload the page. Now I see the same result as you described.
It looks like the problem exists when you reload the page. After pressing the test button, the page is reloaded. That's why I only got the result when I pressed the save button.
I have already found out the following:
- When saving, a
POSTrequest is sent todashboard/settings/mail. - This executes
SettingsController.php::postMail - This creates the
UpdateConfigCommand - The
UpdateConfigCommandis executed by theUpdateConfigCommandHandler. - The
UpdateConfigCommandHandlerwrites the values from the request into the env file - The values for the email settings are not loaded from the env file
I have found out that it is a cache error. The configuration is in the cache, as is the configuration for the emails. Simply writing to the .env file is not enough. It must also be reloaded / the cache must be cleared.
I suggest something like:
// Clears the cached config like artisan config:clear does.
if (app()->configurationIsCached()) {
$this->files->delete(app()->getCachedConfigPath());
}
After writing to the env file in the UpdateConfigCommandHandler.
Note: $this->files is \Illuminate\Filesystem\Filesystem
Yes. When i write it to the .env file and restart Cachet, it is shown in the Admin Webinterface. But NEVER when i change something in the Admin Webinterface, it is written to the .env file
I have found out that it is a cache error. The configuration is in the cache, as is the configuration for the emails. Simply writing to the .env file is not enough. It must also be reloaded / the cache must be cleared.
I suggest something like:
// Clears the cached config like artisan config:clear does. if (app()->configurationIsCached()) { $this->files->delete(app()->getCachedConfigPath()); }After writing to the env file in the
UpdateConfigCommandHandler.Note:
$this->filesis\Illuminate\Filesystem\Filesystem
Hi I also encountered the same issue using cachet-docker installation. Where should I put that fix you mentioned?
Thank you for your input on Cachet 2.x. We are shifting our attention and resources to Cachet 3.x and will no longer be supporting the 2.x version. If your feedback or issue is relevant to the 3.x series, we encourage you to engage with the new branch.
For more information on the Cachet rebuild and our plans for 3.x, you can read the announcement here.
We appreciate your understanding and look forward to your contributions to the new version.