How to create issues from emails?

Added by Fabian L. 3 months ago

Hi everyone,

I'm new to Redmine and it's been asked to me to configure Redmine so that it creates issues from emails.
I've read this in the Administrator Guide: https://www.redmine.org/projects/redmine/wiki/RedmineReceivingEmails and I'm trying to configure it by using the option: Fetching emails from an IMAP server

The thing is that I don't know ruby, rake nor linux systems in depth, so I'd appreciate if someone could explain how to do it (for dummies).

From what I understand, I should create a cron job with something like this to process emails every 30 minutes to create issues of the given tracker in the given project and with the given status and priority:

*/30 * * * * redmineuser rake -f /Apps/redmine/redmine/Rakefile redmine:email:receive_imap ssl=TLS RAILS_ENV="production" host=[my host] port=143 username=[email account] password=[email account's password] project=[my project] status=New tracker=Task priority=High

Now, what is the redmine:email:receive_imap, exactly? Is it a rake task that should be defined in a file called Rakefile?
If so, how should that task be defined?
Could someone please post a sample Rakefile that already includes the redmine:email:receive_imap task?

In addition to this, I don't have full access to the server so for each change or setting needed I'll need to make a request to the sysadmins area of the org (I'm a redmine administrator but from a functional standpoint).

Redmine details:
Redmine version 3.4.6.stable
Ruby version 2.4.5-p335 (2018-10-18) [x86_64-linux]
Rails version 4.2.8

Thanks in advance for your help.
Regards,
Fabian

Replies (7)

RE: How to create issues from emails? - Added by Liane Hampe 3 months ago

Hi Fabian,

You don't need to create a rake task or a Rakefile. Both, the task and file, is already there. What you need w.r.t. your example is the path to the Redmine Rakefile. This is needed since the cron job would be called outside of Redmine's root folder. Therefore, I would rewrite the cron job template a little bit:

*/30 * * * * redmineuser rake -f /path/to/Redmine/Rakefile redmine:email:receive_imap ssl=TLS RAILS_ENV="production" host=[my host] port=143 username=[email account] password=[email account's password] project=[my project] status=New tracker=Task priority=High

The Rakefile of Redmine is in the Redmine root folder.

When you talk to your system administrator please ask him or her if he or she could also update your Redmine instance as well as Ruby and Ruby on Rails.

Your Redmine details show that your system is totally unsupported in terms of security. You should run at least the latest Redmine 4.2.x version along with the latest Ruby 2.7.x and the latest Rails 5.2.x.

Please don't underestimate the cyber security risk these days!

Best Regards,
Liane

RE: How to create issues from emails? - Added by Fabian L. 3 months ago

Hi Liane,

Thanks for your quick response; it was very useful!

I've found the Rakefile in the Redmine's root directory and also the email.rake file with the receive_imap task within it.

I'm now trying to make the cron job work, since new issues are not being created. So I'll check the log file to see what's going on.

Thanks also for your suggestion about getting our Redmine app updated. I've already talked to our org's system administrators and the're planning to do so shortly.

Best regards,
Fabian

RE: How to create issues from emails? - Added by Liane Hampe 3 months ago

Hi Fabian,

Happy to hear that you are making progress.

For testing purpose you can run a rake task also in the root directory of Redmine. When doing so, you don't need to use the `-f` Option in order to point to the Rakefile because Rails is able to find it by itself.

Good luck! :)

Best Regards,
Liane

RE: How to create issues from emails? - Added by Fabian L. 2 months ago

Hi Liane,

Thanks again for your help!

Yes, I'm doing what you suggested (I mean running the task in the Redmine's root directory).
Not sure why, but sometimes emails are marked as read but no issues are created. I'm sending the parameter unknown_user=accept just in case that's the reason why it wasn't creating the tickets.
This is what I'm now executing:

rake redmine:email:receive_imap RAILS_ENV="production" host=[host] port=993 username=[email address] password=[password] project=[project identifier] status=New tracker=Task priority=High move_on_success=redmine_exito move_on_failure=redmine_error unknown_user=accept

In other cases, after some attempts, the execution of the rake task throws different errors. The most common one is:

rake aborted!
Net::IMAP::Error: connection closed

Please see image attached.

Any clue on that?
What might I be missing?

Thanks!
Best,
Fabian

imap error.png (53.3 KB)

RE: How to create issues from emails? - Added by Liane Hampe 2 months ago

Hi Fabian,

Sorry, but the Net::IMAP:Error is very general. Therefore, I have no idea. Perhaps something at your Mail-Server.

Did you had a look into the log file of Redmine? This could give some more information concerning the first problem you reported.

Best Regards,
Liane

RE: How to create issues from emails? - Added by Fabian L. 2 months ago

Hi Liane,

Yes, it seems it's something related to our infrastructure.
Anyway, I've managed to perform several tests creating issues from emails (and I've tested, as well, many of the parameters described in RedmineReceivingEmails).
Thanks again for your help.

Best regards,
Fabian

RE: How to create issues from emails? - Added by Liane Hampe 2 months ago

Hi Fabian,

My pleasure! :)

Best Regards,
Liane

(1-7/7)