Project

General

Profile

Email Notification not send on adding news and adding message forum

Added by Sugeng Widodo about 14 years ago

My environment :
About your application's environment
Ruby version 1.8.7 (i486-linux)
RubyGems version 1.3.5
Rails version 2.1.2
Active Record version 2.1.2
Action Pack version 2.1.2
Active Resource version 2.1.2
Action Mailer version 2.1.2
Active Support version 2.1.2
Application root /var/www/redmine
Environment production
Database adapter mysql
Database schema version 101

email notification working well on issues but not with news and forum message. how this could happend ? The notification settings already all checked.

Thanks


Replies (22)

RE: Email Notification not send on adding news and adding message forum - Added by Gat Lerebourg about 14 years ago

Hi,

I'm working on this problem since few days.

I found out that the field which decide to send the mail or not is always fill by 0.

The field i'm talking is in "members" table and the field is 'mail_notification'.

So, i solved the problem by updating this field by 1 for all rows.

But, i'll be pleased to know how to manage this field in admin area :) !

Bye,

RE: Email Notification not send on adding news and adding message forum - Added by Gat Lerebourg about 14 years ago

Hi again,

Just to say that these updates might not be very good ...

In fact, now, for all issues modifications, every users of the project receive a mail, not only the one who is of charge of the issue ...

Bye,

RE: Email Notification not send on adding news and adding message forum - Added by Gat Lerebourg about 14 years ago

Gat Lerebourg wrote:

Hi,

I'm working on this problem since few days.

I found out that the field which decide to send the mail or not is always fill by 0.

The field i'm talking is in "members" table and the field is 'mail_notification'.

So, i solved the problem by updating this field by 1 for all rows.

But, i'll be pleased to know how to manage this field in admin area :) !

Bye,

Ok. I found out that this option can be congured in each account configuration "Mon compte" - "Notification par email".
So, every one can do what he wants.

RE: Email Notification not send on adding news and adding message forum - Added by Jon Ewing about 14 years ago

A slight extension of this matter:

Is there a way to "_override_" the user email setting for certain notifications - particularly for News? I find that the "Only for things I watch or I'm involved in" doesn't consider the user as involved in project News, which is not the perspective of managers. <j>

RE: Email Notification not send on adding news and adding message forum - Added by Patrick Fratczak about 14 years ago

Yes ... i have the same problem ...
News have to be sent even if the user has changed preferences from his personnal panel !
How to change this ! Because it doesn't work, my users don't use it now !

RE: Email Notification not send on adding news and adding message forum - Added by Dmitry Pupinin over 13 years ago

I'm newbe in Ruby but there is a solution:

Redmine version - 0.9.5
/apps/models/mailer.rb line 143

  def news_added(news)
    redmine_headers 'Project' => news.project.identifier
    message_id news
    recipients news.recipients
    subject "[#{news.project.name}] #{l(:label_news)}: #{news.title}" 
    body :news => news,
         :news_url => url_for(:controller => 'news', :action => 'show', :id => news)
    render_multipart('news_added', body)
  end

replace line
recipients news.recipients
to
recipients news.project.members.collect {|m| m.user}.collect {|u| u.mail}
and mail will send to all members of project

RE: Email Notification not send on adding news and adding message forum - Added by Bruno Medeiros over 13 years ago

Looks like this is being tracked as an issue here: #2549.

There's a Dmitry's similar solution there.

RE: Email Notification not send on adding news and adding message forum - Added by Steven Wong over 12 years ago

HI,
Can anyone develop a plugin to send notification when the news updated?

RE: Email Notification not send on adding news and adding message forum - Added by Dmitry Pupinin over 12 years ago

Steven Wong wrote:

HI,
Can anyone develop a plugin to send notification when the news updated?

Hi Steven!
My message above (2 posts before your) include a patch which allow what you want. Or maybe you want send exactly when news UPDATED?

RE: Email Notification not send on adding news and adding message forum - Added by Steven Wong over 12 years ago

Hi, Dmitry Pupinin

Nice.I tried and it seems work well. Thanks.

RE: Email Notification not send on adding news and adding message forum - Added by Frank Schwarz about 12 years ago

Dmitry Pupinin wrote:

replace line
recipients news.recipients
to
recipients news.project.members.collect {|m| m.user}.collect {|u| u.mail}
and mail will send to all members of project

Many thanks for this hint. Actually, there is no need to change the sources. Just save the following snippet as redmine/config/initializers/mailer_send_news_notifications_to_all_members.rb

module MailerSendNewsNotificationsToAllMembers
  def self.included(base)
    base.class_eval {
      include InstanceMethods
      alias_method_chain :news_added, :all_recipients
    }
  end

  module InstanceMethods
      def news_added_with_all_recipients(news)
        news_added_without_all_recipients(news)
        recipients news.project.members.collect {|m| m.user}.collect {|u| u.mail}
      end
  end
end

Mailer.send(:include, MailerSendNewsNotificationsToAllMembers)

RE: Email Notification not send on adding news and adding message forum - Added by xtu tut almost 12 years ago

Many thanks for this hint. Actually, there is no need to change the sources. Just save the following snippet as redmine/config/initializers/mailer_send_news_notifications_to_all_members.rb

I do not understand why system will start use this snippet ? is it require some settings adjustment...

I've tried to create this file and restart redmine but nothing happend, emails still not sent out.

Could you help me ?

RE: Email Notification not send on adding news and adding message forum - Added by Charlie Kane almost 12 years ago

What type of system are you using? Linux? Windows? If you follow the above script and you're using a Linux-based machine, you shouldn't have a problem. Sheetrock Prices

RE: Email Notification not send on adding news and adding message forum - Added by xtu tut almost 12 years ago

I have Ubuntu. I just put code above into this newly created file
mailer_send_news_notifications_to_all_members.rb
and nothing did more (except restart apache, because my redmine works under apache via the Passenger)

btw, issue email notifications works well

RE: Email Notification not send on adding news and adding message forum - Added by Frank Schwarz almost 12 years ago

The file must be placed into directory config/initializers. It is picked up from there by convention. Not further configuration is required.

RE: Email Notification not send on adding news and adding message forum - Added by xtu tut almost 12 years ago

Yes i did that. I put it into that folder as mentioned in message above. How I can debug or make sure that this piece of code is running, after I added new News ?

RE: Email Notification not send on adding news and adding message forum - Added by xtu tut almost 12 years ago

Except this file I have couple files into the same folder
..
10-patches.rb
20-mime_types.rb
30-redmine.rb
backtrace_silencers.rb
bigdecimal-segfault-fix.rb
inflections.rb
mailer_send_news_notifications_to_all_members.rb
session_store.rb

RE: Email Notification not send on adding news and adding message forum - Added by Frank Schwarz almost 12 years ago

The author of the news item is excluded from the recipients list. This is also true for this patch. You should play with two accounts to verify if it is working.

You could add below the line "news_added_without_all_recipients(news)" this log statement to see if the patch is active at least:

logger.info "I was here" 

RE: Email Notification not send on adding news and adding message forum - Added by xtu tut almost 12 years ago

Actually I had play this two accounts from beginning. Now i add the "log info" line into file where you said, and nothing happens again.
In logs i could see only next info


Processing NewsController#index (for IP at 2012-03-23 09:48:04) [GET]
  Parameters: {"project_id"=>"ttt", "action"=>"index", "controller"=>"news"}
Rendering template within layouts/base
Rendering news/index
Completed in 75ms (View: 55, DB: 5) | 200 OK [http://domain/projects/ttt/news]

Processing NewsController#create (for IP at 2012-03-23 09:48:17) [POST]
  Parameters: {"commit"=>"Create", "project_id"=>"ttt", "action"=>"create", "authenticity_token"=>"token_here, "controller"=>"news", "news"=>{"title"=>"test 2", "description"=>"test desc 2", "summary"=>"test summ 2"}}
Redirected to http://domain/projects/ttt/news
Completed in 31ms (DB: 13) | 302 Found [http://domain/projects/ttt/news]

Processing NewsController#index (for IP at 2012-03-23 09:48:17) [GET]
  Parameters: {"project_id"=>"ttt", "action"=>"index", "controller"=>"news"}
Rendering template within layouts/base
Rendering news/index
Completed in 218ms (View: 198, DB: 3) | 200 OK [http://domain/projects/ttt/news]

RE: Email Notification not send on adding news and adding message forum - Added by xtu tut almost 12 years ago

seems to me I have redmine version is: 2011-05-30 v1.2.0 (took from changelog)

    (1-22/22)