https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292013-06-11T06:10:18ZRedmineRedmine - Defect #14251: Redmine email reminders sending 4 emails everytime cron runshttps://www.redmine.org/issues/14251?journal_id=499972013-06-11T06:10:18ZDiego Antunes
<ul></ul><p>Definitely runs only once, but sends out 4 emails each time it runs.</p> Redmine - Defect #14251: Redmine email reminders sending 4 emails everytime cron runshttps://www.redmine.org/issues/14251?journal_id=502012013-06-25T12:37:16ZChristian Buczek
<ul></ul><p>same effect on <em>Windows Server</em> and <em>Redmine 1.4.0</em></p>
<pre>
D:\redmine\apps\redmine\htdocs>rake redmine:send_reminders days=1 users="3" RAILS_ENV="production" --trace
Please install RDoc 2.4.2+ to generate documentation.
** Invoke redmine:send_reminders (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute redmine:send_reminders
</pre>
<p>-> sends <strong>3x</strong> Mails with same value</p>
<p>CanĀ“t see why. Seems all alright in <strong>mailer.rb</strong>:<br /><pre>
# Sends reminders to issue assignees
# Available options:
# * :days => how many days in the future to remind about (defaults to 7)
# * :tracker => id of tracker for filtering issues (defaults to all trackers)
# * :project => id or identifier of project to process (defaults to all projects)
# * :users => array of user ids who should be reminded
def self.reminders(options={})
days = options[:days] || 7
project = options[:project] ? Project.find(options[:project]) : nil
tracker = options[:tracker] ? Tracker.find(options[:tracker]) : nil
user_ids = options[:users]
scope = Issue.open.scoped(:conditions => ["#{Issue.table_name}.assigned_to_id IS NOT NULL" +
" AND #{Project.table_name}.status = #{Project::STATUS_ACTIVE}" +
" AND #{Issue.table_name}.due_date = ?", days.day.from_now.to_date]
)
scope = scope.scoped(:conditions => {:assigned_to_id => user_ids}) if user_ids.present?
scope = scope.scoped(:conditions => {:project_id => project.id}) if project
scope = scope.scoped(:conditions => {:tracker_id => tracker.id}) if tracker
issues_by_assignee = scope.all(:include => [:status, :assigned_to, :project, :tracker]).group_by(&:assigned_to)
issues_by_assignee.each do |assignee, issues|
deliver_reminder(assignee, issues, days) if assignee.is_a?(User) && assignee.active?
end
end
</pre></p>
<p>btw: SMTP Server is in local network (tried <em>exchange server</em> and <em>hamster</em> )</p>