Problem with E-Mail Notifications activation

Added by S S 5 months ago

Hello.
I'm trying to turn on email notifications.

While I'm trying to change configuration.yml file occurs an error:

We're sorry, but something went wrong.
Error: Web application could not started

Error ID differs every time so I can find nothing.
It happens when I write absolutely anything in this file.

Could, please, anybody tell how to solve this problem?

Environment:
  Redmine version                3.4.4.stable
  Ruby version                   2.4.2-p198 (2017-09-14) [x86_64-linux]
  Rails version                  4.2.8
  Environment                    production
  Database adapter               Mysql2
SCM:
  Subversion                     1.7.14
  Git                            1.8.3.1
  Filesystem                     
Redmine plugins:
  a_common_libs                  2.4.2
  easy_gantt                     1.10
  global_roles                   2.2.1
  redmine_agile                  1.4.5
  redmine_sender                 1.4.1
CentOS 7

Also on another forum I was advised to check the reslut of "rails s" command from the Redmine root directory and occured another error:
Could not find gem 'mailcatcher' in any of the gem sources listed in your Gemfile. - FIXED
Thank you in advance for help.

11.jpg - Email error (126 KB)

Screenshot_11.jpg - Gem error (104 KB)

Screenshot_11.jpg - Gem error (104 KB)

11.jpg - Email error (126 KB)

Replies (15)

RE: Problem with E-Mail Notifications activation - Added by Martin Denizet (redmine.org team member) 5 months ago

Hello,
Did you "cd" to your installation path before running the bundle install?
I cannot see mailcatcher gem being installed in my test Redmine, does it come from a plugin?
What error do you get in your production.log?
Cheers,

RE: Problem with E-Mail Notifications activation - Added by S S 5 months ago

Yes, I run bundle install from redmine installation directory.
What about mailcatcher, I saw its name first time in this error message. So I don't know why Redmine requires this gem.
And i have no errors in production.log
Maybe there are another files I need to change except configuration.yml or another nuances?

RE: Problem with E-Mail Notifications activation - Added by Martin Denizet (redmine.org team member) 5 months ago

Check the plugins installed.
In the plugin requiring mailcatcher in its Gemfile, edit the Gemfile and add as the first line:

source 'https://rubygems.org'

Then run a bundle install --without development test again and see if you can run the server with bundle exec rails s
Cheers,

RE: Problem with E-Mail Notifications activation - Added by Martin Denizet (redmine.org team member) 5 months ago

According to the documentation, if it still doesn't work, try:

gem install mailcatcher

Doc said:

Bundler
Please don't put mailcatcher into your Gemfile. It will conflict with your applications gems at some point.

Instead, pop a note in your README stating you use mailcatcher. Simply run gem install mailcatcher then mailcatcher to get started.

Cheers,

RE: Problem with E-Mail Notifications activation - Added by S S 5 months ago

Really, I found a plugin which required mailcatcher. Thank you for hint, I deleted this plugin.
But problem with notifications didnt't disappear.
I run bundle exec rails s command and now picture is so.
As I understand Redmine isn't able to connect to database?
I don't see another errors..

Screenshot_2.png (24.8 KB)

RE: Problem with E-Mail Notifications activation - Added by Martin Denizet (redmine.org team member) 5 months ago

Try instead:

bundle exec rails s -e production

By default, dev environment is started it there is no reason you configured you database.yml for dev environment.
If you still have a database connection error in production environment, check your database.yml for errors.
Cheers,

RE: Problem with E-Mail Notifications activation - Added by S S 5 months ago

I run this command and didn't notice database error in production environment.

So what can be done with such error in development mode? As I see running

 bundle exec rails s 
it starts in development mode.

I tried to change database.yml writing the same parametres for development, as result I have no database error, but I see the same error page for notifications.
Or should I delete everything about development in my database.yml?

RE: Problem with E-Mail Notifications activation - Added by Martin Denizet (redmine.org team member) 5 months ago

Sorry, I'm a bit confused. If I understand correctly, your install runs fine in production environment but that's not what you want, you want to have it run in development environment. Is that correct?
Development environment is made for developers writing code/plugins in Redmine, the Rails app reloading as they are writing code.

RE: Problem with E-Mail Notifications activation - Added by S S 5 months ago

I'm sorry, it seems like I didn't understand you correctly.
Do command bundle exec rails s -e production restart server in production environment?
I have no error with database running this command, but I still have error page while changing configuration.yml and trying to turn on email notofications.

RE: Problem with E-Mail Notifications activation - Added by Martin Denizet (redmine.org team member) 5 months ago

What's your email configuration?
What error do you get when you enable email notification and you start the server in production environment?
It could be a YAML formatting error, YAML is sensible to indentation and it should be indented with spaces.
If you edit the file with Windows, you should use a software like Notepad++ with the option Show all characters enabled to make sure formatting is correct.

RE: Problem with E-Mail Notifications activation - Added by S S 5 months ago

I'm not able to enable email notifications. Server doesn't start at all when I'm changing anything in my configuration.uml
Screenshot shows what I see after editing file and restarting nginx.
It starts working again only if I comment all strings in configuration.yml
I edit configuration file with CentOS.
Also I run rails s again and noticed an error about undefined method in base.rb (screenshots are attached)
I opened this file and found that string 569 but I can't understand what I should write in this place.

11.jpg - redmine start page error (126 KB)

Screenshot_3.png - base.rb (8.46 KB)

screenshot.png - rails s error (42.6 KB)

RE: Problem with E-Mail Notifications activation - Added by Martin Denizet (redmine.org team member) 5 months ago

Could you please attached your configuration.yml(as a text file, not a screenshot) with email delivery enabled and sensitive information redacted?

RE: Problem with E-Mail Notifications activation - Added by S S 5 months ago

Here is configuration.yml with settings how I write (uncommented).

configuration.yml Magnifier (8.12 KB)

RE: Problem with E-Mail Notifications activation - Added by Martin Denizet (redmine.org team member) 5 months ago

Thanks, we can go to the bottom of that.
This is your file without the comments and with indentation spaces replaced with dots:

default:
..email_delivery:
....email_delivery:
....delivery_method: :smtp
....smtp_settings:
....address: mail.ros.ru

The correct formatting is:
default:
..email_delivery:
-....email_delivery:
....delivery_method: :smtp
....smtp_settings:
- ....address: mail.ros.ru
+ ......address: mail.ros.ru

Indentation is critical in YAML.
Modified file attached.
Cheers,

configuration.yml Magnifier - Corrected file (8.11 KB)

RE: Problem with E-Mail Notifications activation - Added by S S 5 months ago

Oh, it helped, thank you a lot!

(1-15/15)