Defect #4228

no notification on issue creation by mail with redmine:email:receive_imap

Added by Jérôme Bousquié about 8 years ago. Updated over 6 years ago.

Status:ClosedStart date:2009-11-17
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Email notifications
Target version:-
Resolution:Invalid Affected version:

Description

Hello,

I have Redmine 0.8.7 running on ubuntu 8.40 with Rails 2.3.4 , ruby 1.8.6, mysql and apache/phusion.
Redmine sends and receives mails without any problem. It is set up to create issues via email and this functionality runs well too. It's configured as an imap client.
My problem is :
given an user (authorized to submit issues to my project), email notifications are sent to the project members (they are set up to be notified) if this user creates an issue in the web interface. If the same user sends a mail to create an issue, the issue is created well but no notification are sent to the project members (even if there is an automatic assignation by category on this issue).

On issue creation, the notification seems not to be working with the rake redmine:email:receive_imap (set up with async_imap).
Nothing is visible in the log about some email sending after having commented the paramater config.action_mailer.logger = nil in the configuration.

I remember I used to use rdm-mailhandler in my previous organisation and it used to notify the project members on email issue creation. I just tested it on https://projets-lim.univ-reunion.fr/

Any idea ? does rake redmine:email:receive_imap and rdm-mailhandler behave differently about the issue management ?

thank you

output.txt Magnifier (11.6 KB) Evgeny Zhiryakov, 2011-03-01 05:38


Related issues

Related to Redmine - Patch #613: Asynchronous email delivery Closed 2008-02-06
Related to Redmine - Defect #6069: No Outgoing Mails when Customer creates Ticket via Mail New 2010-08-06
Duplicated by Redmine - Defect #5058: reminder mails are not sent when delivery_method is :asyn... Closed 2010-03-12

Associated revisions

Revision 3115
Added by Jean-Philippe Lang about 8 years ago

Add assertion about email notification on issue creation via email (#4228).

History

#1 Updated by Jean-Philippe Lang about 8 years ago

  • Category set to Email notifications

#2 Updated by Jérôme Bousquié about 8 years ago

Hello,

On the same deployment (https://projets.iut-rodez.fr/), I set up redmine to receive emails via postfix and the project members are now notified, even on mail issue submission. So the notification behavior really differs on email issue creation between imap et postfix processes.

regards

#3 Updated by Jean-Philippe Lang about 8 years ago

Any idea ? does rake redmine:email:receive_imap and rdm-mailhandler behave differently about the issue management ?

Emails submitted by the rake task and rdm-mailhandler are both processed by MailHandler class.
So behaviour should be the same.

How can I reproduce this problem?

#4 Updated by Mihail Rukavishnikov over 7 years ago

Hello,

There are no any calls to notification mechanism when creating issues from email. Issues are created using the following code (see app/models/mail_handler.rb:

 issue = Issue.new(:author => user, :project => project, :tracker => tracker, :category => category, :priority => priority, :due_date => due_date, :start_date => start_date, :assigned_to => assigned_to)

...

issue.save!
add_attachments(issue)

So, the possible solution is to add something like the following after saving the issue:

Mailer.deliver_issue_add(issue) if Setting.notified_events.include?('issue_added') 

#5 Updated by Anton Nepomnyaschih almost 7 years ago

+1. We have the same problem :( Jean, do you need any help with this? Steps to reproduce or any?..

#6 Updated by Anton Nepomnyaschih almost 7 years ago

How can I add any log-file which can show you the problem and steps to reproduce?

#7 Updated by Evgeny Zhiryakov almost 7 years ago

Same problem, issues received by email doesn't generate notifications.
Redmine 1.1.1 from svn revision 4802, running on Debian 6.0, ruby 1.8.7, rails 2.3.5, mysql and apache/passanger.
I don't know how reproduce this problem, but I want help as I can.

#8 Updated by Etienne Massip almost 7 years ago

You could change logging level to get some debug trace from Redmine::IMAP and MailHandler ?

In config/environments/production.rb :

...
# Disable delivery errors if you bad email addresses should just be ignored
config.action_mailer.raise_delivery_errors = true

# No email in production log
# config.action_mailer.logger = nil
config.log_level = :debug

#9 Updated by Evgeny Zhiryakov almost 7 years ago

Turning on debug log level showed NOTHING about this problem.
The unit test mail_handler_test.rb showing only one failure:

# ruby test/unit/mail_handler_test.rb -v
...
Finished in 3.345716 seconds.

  1) Failure:
test_add_issue_should_send_email_notification(MailHandlerTest) [test/unit/mail_handler_test.rb:295]:
<1> expected but was
<2>.

35 tests, 182 assertions, 1 failures, 0 errors

What this mean?

#10 Updated by Etienne Massip almost 7 years ago

Could you please add the followinng lines before assert_equal to source:trunk/test/unit/mail_handler_test.rb#L295 and run the test again ?

logger.info ActionMailer::Base.deliveries[0].inspect
logger.info ActionMailer::Base.deliveries[1].inspect

Then you should have the description of both objects in log file.

#11 Updated by Evgeny Zhiryakov almost 7 years ago

I added these lines:

RAILS_DEFAULT_LOGGER.info ActionMailer::Base.deliveries[0].inspect
RAILS_DEFAULT_LOGGER.info ActionMailer::Base.deliveries[1].inspect

But in the log file does't appear any new information.

#12 Updated by Etienne Massip almost 7 years ago

Yes, sorry, it's a test so it should not log anything. Could you try by replacing RAILS_DEFAULT_LOGGER.info with puts, please ?

#13 Updated by Evgeny Zhiryakov almost 7 years ago

Something has issued, but I don't understand what.

Loaded suite mail_handler_test
Started
.................#<TMail::Mail port=#<TMail::StringPort:id=0x..fdab13bcc> bodyport=#<TMail::StringPort:id=0x..fdab0f2ac>>
#<TMail::Mail port=#<TMail::StringPort:id=0x..fdaaeb406> bodyport=#<TMail::StringPort:id=0x..fdaae8a76>>
F.................
Finished in 3.55149 seconds.

  1) Failure:
test_add_issue_should_send_email_notification(MailHandlerTest) [mail_handler_test.rb:297]:
<1> expected but was
<2>.

#14 Updated by Etienne Massip almost 7 years ago

Next try :

p ActionMailer::Base.deliveries[0].header.inspect
p ActionMailer::Base.deliveries[0].body
p ActionMailer::Base.deliveries[1].header.inspect
p ActionMailer::Base.deliveries[1].body

#15 Updated by Evgeny Zhiryakov almost 7 years ago

Done, I attached the output in file output.txt

#16 Updated by Etienne Massip almost 7 years ago

That is twice the same mail.

What is you mail configuration, please ?

#17 Updated by Evgeny Zhiryakov almost 7 years ago

# Outgoing email settings

production:
  delivery_method: :async_smtp
  smtp_settings:
    tls: true
    address: "smtp.gmail.com" 
    port: '587'
    domain: "smtp.gmail.com" 
    authentication: :plain
    user_name: "redmine@******.com" 
    password: "********" 

#18 Updated by Etienne Massip almost 7 years ago

Could you try the fix of Go MAEDA for async_smtp issue in #5058, please ?

#19 Updated by Evgeny Zhiryakov almost 7 years ago

Thanks a lot for the tip, I just change async_smtp to smtp, and notification began to come.
- delivery_method: :async_smtp
+ delivery_method: :smtp

P.S. Method of Go MAEDA for async_smtp issue dosen't help me.

#20 Updated by Etienne Massip almost 7 years ago

AFAIK, :async_imap has no effect ?!

I think that this issue is actually the same as #5058.

#21 Updated by Etienne Massip almost 7 years ago

If you have some time left, could you make a new attempt for :async_smtp with the 2 following lines added to lib/tasks/email.rake :

task :receive_imap => :environment do
  Thread.abort_on_exception = true
  ...
  (existing code)
  ...
  threads.each {|t| t.join }
end

#22 Updated by Etienne Massip over 6 years ago

  • Status changed from New to Closed
  • Resolution set to Invalid

Resolved by switching smtp delivery_method setting from async_smtp to smtp, which is kind of a feature loss.

Would be great if someone could post a feedback about the change proposed in note-21.

Also available in: Atom PDF