Defect #4920

Email notifications on file upload sent to empty recipient list

Added by Jon Pascoe over 7 years ago. Updated over 7 years ago.

Status:ClosedStart date:2010-02-24
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Email notifications
Target version:0.9.4
Resolution:Fixed Affected version:0.9.2

Description

I have installed a vanilla copy of Redmine 0.9.2.stable.3474 (MySQL)

In administration -> settings -> Email notifications, the emission email address is correctly set, and "file added" is ticked for notifications.
If I click "Send a test email" from the bottom of the page, the test email is correctly sent and received to my email inbox.

If I now go to a project with just myself as a member, and upload a file, a delivery failure is bounced to the sending account.
Looking in the mailserver logs for the receiving server, I can see that no receipients are set:

qmail-queue-handlers[1697]: Handlers Filter before-queue for qmail started ...
qmail-queue-handlers[1697]: from=redmine@****.co.uk
qmail-queue-handlers[1697]: to=
qmail-queue-handlers[1697]: hook_dir = '/usr/local/psa/handlers/before-queue'
qmail-queue-handlers[1697]: recipient[3] = ''

I have tested this with and without 'BCC' selected in the email notifications settings, with identical results.

Why is Redmine not sending the email with a list of recipients?


Related issues

Related to Redmine - Patch #4966: Defect #4671 No Email Notification on New File Added to R... Closed 2010-03-02

Associated revisions

Revision 3518
Added by Jean-Philippe Lang over 7 years ago

Adds a test for not sending email without recipient (#4920).

History

#1 Updated by Jon Pascoe over 7 years ago

As per the FAQ, I modified my config/environments/production.rb settings so that mailer activities would be logged. As you can see, this confirms the issue of no recipient addresses being used:

Processing ProjectsController#add_file (for xxx.xxx.xxx.xxx at 2010-02-24 15:50:08) [POST]
  Parameters: {"commit"=>"Add", "action"=>"add_file", "authenticity_token"=>"PhQkKzGZ2diEjdIdjsZHPootAQpWWElnx4LkI22/I=", "id"=>"projectid", "controller"=>"projects", "attachments"=>{"1"=>{"file"=>#<File:/tmp/RackMultipart20100224-84201-1ashycm-0>, "description"=>"test"}}}
Sent mail to 
Redirected to http://*******.co.uk/projects/projectid/files
Completed in 508ms (DB: 3) | 302 Found [http://*******.co.uk/projects/projectid/files/new]

#2 Updated by Jon Pascoe over 7 years ago

Further to the details above ... My original installation of Redmine was on OSX. That copy is still installed, and still broken.

Since then I created a Fedora VM to test it out there, installed Redmine, and everything is working as expected.

Both installations are approximately identical, bar a few vendor packaging differences.
Both use Apache, Passenger, MySQL, and rails versions. Also, they're both configured with the same email account/server for sending mail.

There is one difference ... Fedora has Ruby 1.8.6, and OSX has Ruby 1.8.7.
I find it hard to believe that is the problem though.

#3 Updated by Jean-Philippe Lang over 7 years ago

Emails without recipients should not be sent.
A test was added for that in r3518 and it passes with ruby 1.8.7.

#4 Updated by Jon Pascoe over 7 years ago

I have retested on OSX, with another user added to the project. Again, when a file is uploaded an email is generated with no recipients.
The problem isn't that an email isn't being sent, but that an email is being sent without recipients.

Identical tests on my Fedora installation work perfectly, only my OSX installation is affected.

I have re-installed my OSX redmine from scratch, to be sure I haven't messed up the install, and the problem still occurs.

#5 Updated by Andrew Rudenko over 7 years ago

I just want to add some details:
if submit any changes to the issues, we can see in production.log the message like this:

Sending email notification to: name1.surname1@email.domain.com, name2.surname2@email.domain.com, name3.surname3@email.domain.com

but if we add a new document or upload a file, we can see another recipients list:

Sending email notification to: Name1 Surname1, Name2 Surname2, Name3 Surname3

and the notification is not received in the last case.
the logic for recipients has been updated in app/modules/mailer.rb for 9.2 version, and it seems not accurately well.

#6 Updated by Andrew Rudenko over 7 years ago

I've changed app/models/mailer.rb a little and now all notifications are sent to their recipients

Index: app/models/mailer.rb
===================================================================
--- app/models/mailer.rb        (revision 3521)
+++ app/models/mailer.rb        (working copy)
@@ -114,11 +114,11 @@
     when 'Project'
       added_to_url = url_for(:controller => 'projects', :action => 'list_files', :id => container)
       added_to = "#{l(:label_project)}: #{container}" 
-      recipients container.project.notified_users.select {|user| user.allowed_to?(:view_files, container.project)}
+      recipients container.project.notified_users.select {|user| user.allowed_to?(:view_files, container.project)}.collect  {|m| m.mail}
     when 'Version'
       added_to_url = url_for(:controller => 'projects', :action => 'list_files', :id => container.project_id)
       added_to = "#{l(:label_version)}: #{container.name}" 
-      recipients container.project.notified_users.select {|user| user.allowed_to?(:view_files, container.project)}
+      recipients container.project.notified_users.select {|user| user.allowed_to?(:view_files, container.project)}.collect {|m| m.mail}
     when 'Document'
       added_to_url = url_for(:controller => 'documents', :action => 'show', :id => container.id)
       added_to = "#{l(:label_document)}: #{container.title}" 

#7 Updated by Jon Pascoe over 7 years ago

  • Status changed from New to Resolved
  • Assignee set to Jean-Philippe Lang

I've added those changes to my OSX installation and retested ... notifications for file uploads now work perfectly.

#8 Updated by Jean-Philippe Lang over 7 years ago

  • Status changed from Resolved to Closed
  • Target version set to 0.9.4
  • Resolution set to Fixed

Fixed was committed in r3532.

#9 Updated by Jean-Philippe Lang over 7 years ago

  • Subject changed from Email notifications sent to empty recipient list to Email notifications on file upload sent to empty recipient list

Also available in: Atom PDF