Create issues into multiple projects from multiple email addresses

Added by Frédéric GOEPFERT 3 months ago

Hi,

We are on Redmine 4.0.4 on Windows using Bitnami Redmine and try to implement incoming emails functionality.

Our goal is to create issues into different projects depending on the email sender.
Example :
  • emails sent by john@biometal.com should generate an issue in a project called biometal
  • emails sent by jane@tradmax.com should generate an issue in a project called tradmax
  • ...
Considering the email sender matches users located in their respective projects, we are trying to run several commands (one per projects) like the following :
  • bundle exec rake -f C:\Bitnami\redmine-4.0.4-3/apps/redmine/htdocs/Rakefile redmine:email:receive_imap RAILS_ENV="production" host="myhost" port="993" ssl="1" username="myuser" password="mypassword" move_on_success="inbox/REDMINE/SUCCESS" project="biometal" tracker="Support" status="New"
  • bundle exec rake -f C:\Bitnami\redmine-4.0.4-3/apps/redmine/htdocs/Rakefile redmine:email:receive_imap RAILS_ENV="production" host="myhost" port="993" ssl="1" username="myuser" password="mypassword" move_on_success="inbox/REDMINE/SUCCESS" project="tradmax" tracker="Support" status="New"

Our problem is that when the first command is executed all emails received are marked as read (even the emails coming from users that are not in the target project). So when the next command in executed the email from the sender attached to the project is no more detected and no issue is created.

Apparently we should use the project_from_subadress command line argument but we can't figure out how. Does anyone have an example or any idea how to make things work ?

Thanks !
Fred

Replies (1)

RE: Create issues into multiple projects from multiple email addresses - Added by Frédéric GOEPFERT 3 months ago

I finally found the trick, I had to modify the file imap.rb in order to force the email to be marked as unread.

This is done simply by adding imap.uid_store(uid, "-FLAGS", [:Seen]) at the end of the imap.uid_search(['NOT', 'SEEN']).each loop :

imap_rb.jpg (98.9 KB)

(1-1/1)