I can't get rake to work

Added by Marcus Lopes over 10 years ago

I tried all the possible ways to run rake to pick up the emails.

It does read them because after I run it they get flagged as "read"

but it does not add them to the queue I created for tickets sent via email

Here is a quick overview

the name of the queue is "Inbox"

and on my rake I'm forcing everything to go in there

Here is the rake

rake redmine:email:receive_imap host=192.168.111.11 username=redmine password=password port=993 ssl=1 allow_override=project,tracker,priority,status,issue unknown_user=accept unknown_user=create project=Inbox tracker=Bug

one more thing... all the emails are coming from users that have redmine accounts

and here is my environment

Rails 2.3.4
ruby 1.8.7
gem 1.3.4

  • LOCAL GEMS ***

actionmailer (2.3.4)
actionpack (2.3.4)
activerecord (2.3.4)
activeresource (2.3.4)
activesupport (2.3.4)
daemons (1.0.10)
fastthread (1.0.7)
gem_plugin (0.2.3)
mysql (2.8.1)
passenger (2.2.5)
rack (1.0.0)
rails (2.3.4)
rake (0.8.7)

mysql 5.0

Replies (14)

RE: I can't get rake to work - Added by Marcus Lopes over 10 years ago

I got an OK from my company to offer compensation for this and maybe some other issues.

Let me know if you are interested

Thanks

Marcus

RE: I can't get rake to work - Added by Felix Schäfer over 10 years ago

Hello Marcus,

I don't think you will need to offer compensation for this, depending on what you are trying to do, as this is an existing functionality of redmine, but you might donating to the project :-) Another note about this forum: although it's part of the official redmine.org page, the devs don't come here regularly, and they are here for users helping other users. If you find specific bugs or have specific requests, skim through existing tickets, or write a new one if it's not already there.

Anyway, I got this working on one of my redmine installations (didn't try on the others), so I'll try to get through this with you. Which version of redmine is affected, 0.8.7 or trunk? Also, I can't find any documentation on allow_override=issue (and right now, it doesn't even make sense to me) or unknown_user=accept unknown_user=create, could you please try again after having removed them? Lastly, have a look at the redmine logs or the trace of the rake command (just add --trace to the command) to see if there is something strange or suspicious in them.

RE: I can't get rake to work - Added by Marcus Lopes over 10 years ago

Thanks

The redmine version is Redmine 0.8.5

I don't think it's a bug because it's acutally reaching and reading the emails the problem is that it's not placing them anywhere

After I run rake it flags the emails as read

So I change the rake command to the one below

rake redmine:email:receive_imap host=192.168.xxx.xxx username=redmine password=password port=993 ssl=1 allow_override=project,tracker,priority,status project=Inbox tracker=Bug --trace

and I still got the same result

the emails get flagged as read on the server but are not placed anywhere on redmine

here is my trace log

  • Invoke redmine:email:receive_imap (first_time)
  • Invoke environment (first_time)
  • Execute environment
  • Execute redmine:email:receive_imap

RE: I can't get rake to work - Added by Felix Schäfer over 10 years ago

So, having a look at the Guide wrt IMAP Mail receiving, it states:

Emails that are ignored (unknown user, unknown project...) are marked as 'Seen' but are not deleted from the IMAP server.

I think the problem might be that you have put the name after the project=, not the identifier, which it should be. You can find the identifier in the URLs to the project.

The other thing you could try is to answer any mail you get from redmine for an issue creation or update, that should append the content of the mail as a comment to the issue.

RE: I can't get rake to work - Added by Marcus Lopes over 10 years ago

You were right I was using the name instead of the identifier.

I tried with the identifier and still no luck

rake redmine:email:receive_imap host=192.168.xxx.xxx username=redmine password=password port=993 ssl=1 allow_override=project,tracker,priority,status project=Inbox tracker=Bug --trace

Do you think I need the allow_override option?

let's say that my emails is on the format below


From: Marcus Lopes <>
to:

Subject: test

Body:

this is a test


would the rake command above know what to do with the email??

RE: I can't get rake to work - Added by Felix Schäfer over 10 years ago

Well, first of all, you can drop the --trace, as there's nothing interesting there at the moment. Second, although you said you used the identifier, you still have Inbox with an uppercase although identifiers are all lowercase, but let's assume you have this right.

The allow_override option allows you to define special commands in the mail to override the defaults you set on the command line. For example, you specified tracker=Bug in your rake command, which by default creates new issues as bugs, but if you were to put a line containing "Tracker: Feature" in your mail, it would get created as a feature because you have tracker in allow_override. Whether and what you need in allow_override depends on what you try to achieve, if you want each and every mail that is not a reply to an issue mail from redmine to be created as a new bug in the inbox project, you won't need it, if you want to give your users, leave it as it is.

Regarding your test email, make sure the mail address you send the mail from belongs to an active user in redmine and that that user has issue creation rights in the project the issue should get created in.

RE: I can't get rake to work - Added by Marcus Lopes over 10 years ago

Check list

1. rake command

rake redmine:email:receive_imap host=192.168.xxx.xxx username=redmine password=password port=993 ssl=1 allow_override=project,tracker,priority,status project=emailed tracker=Bug

I had copied and paste the wrong one here

2. email used in from is mine and I'm and admin

Still no tickets

RE: I can't get rake to work - Added by Felix Schäfer over 10 years ago

Marcus Lopes wrote:

1. rake command

rake redmine:email:receive_imap host=192.168.xxx.xxx username=redmine password=password port=993 ssl=1 allow_override=project,tracker,priority,status project=emailed tracker=Bug

I had copied and paste the wrong one here

Ok, that looks good.

2. email used in from is mine and I'm and admin

Still no tickets

Well, being an admin and having the "Create issue" (or whatever it's called exactly) right isn't exactly the same, and might not be taken into account in the rake task. Try to ad yourself to the project with a role that has issue creation rights.

Another thing that just dawned on me: I suppose the rake task will ignore any read mail as it's the state it puts it in after having rejected it, so make sure to resend a mail for each attempt.

Last but not least: do you expect the issues to appear on a development system? Rake defaults to the development environment if none is specified, you might need to preface the rake command with RAILS_ENV=production if you expect to see stuff happening on your production redmine.

RE: I can't get rake to work - Added by Marcus Lopes over 10 years ago

First of all thanks for all the help...

Well, being an admin and having the "Create issue" (or whatever it's called exactly) right isn't exactly the same, and might not be taken into account in the rake task. Try to ad yourself to the project with a role that has issue creation rights.

The role that I'm assigned to has permission to create issues

Another thing that just dawned on me: I suppose the rake task will ignore any read mail as it's the state it puts it in after having rejected it, so make sure to resend a mail for each attempt.

I made sure the emails were flagged as unread

Last but not least: do you expect the issues to appear on a development system? Rake defaults to the development environment if none is specified, you might need to preface the rake command with RAILS_ENV=production if you expect to see stuff happening on your production redmine.

I'm running on development env

No new tickets on redmine

I was able to read emails from the same machine using telnet

RE: I can't get rake to work - Added by Felix Schäfer over 10 years ago

Well, I'm running short on ideas here… I just had a closer look at the code, btw, and unknown_user= is a valid parameter, but only once, having it twice will have one of both ignored, as the 3 possible options for this are mutually exclusive.

The next best thing would be to have a look at the logs redmine produces, there should be a message at debug level for each email it processes. And again, even if I seem insistent on the matter: send a fresh mail each time or even better make redmine send you a mail for an issue creation or update, and answer to that mail.

Regarding the telnet connection: that's confirmation that it works, but we already knew that, because the messages would get flagged as "seen" on the IMAP server. The problem here seems to be either misconfiguration/misusage, or a problem with redmine and the whole underlying stack.

RE: I can't get rake to work - Added by Marcus Lopes over 10 years ago

The next best thing would be to have a look at the logs redmine produces, there should be a message at debug level for each email it processes. And again, even if I seem insistent on the matter: send a fresh mail each time or even better make redmine send you a mail for an issue creation or update, and answer to that mail.

Are you talking about development.log or production.log?

thanks

RE: I can't get rake to work - Added by Felix Schäfer over 10 years ago

Well, if you use redmine in production mode, have a look at production.log, if you use it in development mode, have a look at development.log :-)

RE: I can't get rake to work - Added by Marcus Lopes over 10 years ago

Awesome - Solved

Well, if you use redmine in production mode, have a look at production.log, if you use it in development mode, have a look at development.log :-)

I had look into the log before

the issue was a bunch of things combined

My original rake command had a bunch of stuff that was canceling each other.

The starting from the lean rake I was able to see what was the last problem looking back in the log as you suggested.

It was the priority.... it's set to be required and none of the email had the priority assigned.

so just to make sure I added the priority=Low in the rake line so all of the new tickets get assigned to low priority in the Inbox project

and everything works now

Thanks a Bunch Felix

RE: I can't get rake to work - Added by Felix Schäfer over 10 years ago

You're welcome :-)

(1-14/14)