Fetch email stopped working

Added by John Simmons about 4 years ago

Hey, I'm on version 3.2.0.stable.15058

Up until about 4 months ago, I had been using the redmine receive email functionality located here RedmineReceivingEmails

I was using the fetch from imap method.

I haven't made any changes that I can think of since then, and now it doesn't work.

when I run this command:

/usr/local/bin/rake -s -f /opt/redmine/current/Rakefile --trace redmine:email:receive_imap RAILS_ENV="production" host=mail.mycompany.com username= password=myPassword unknown_user=accept

I get the following error (this was the same command I ran several times before four months ago that worked fine)

  • Invoke redmine:email:receive_imap (first_time)
  • Invoke environment (first_time)
  • Execute environment
  • Execute redmine:email:receive_imap
    rake aborted!
    Errno::ECONNRESET: Connection reset by peer - SSL_connect
    /usr/lib/ruby/2.0.0/net/imap.rb:1454:in `connect'
    /usr/lib/ruby/2.0.0/net/imap.rb:1454:in `start_tls_session'
    /usr/lib/ruby/2.0.0/net/imap.rb:1047:in `initialize'
    /opt/redmine/current/lib/redmine/imap.rb:30:in `new'
    /opt/redmine/current/lib/redmine/imap.rb:30:in `check'
    /opt/redmine/current/lib/tasks/email.rake:116:in `block (4 levels) in <top (required)>'
    /opt/redmine/current/app/models/mailer.rb:432:in `with_synched_deliveries'
    /opt/redmine/current/lib/tasks/email.rake:115:in `block (3 levels) in <top (required)>'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
    /usr/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
    /usr/local/bin/rake:23:in `load'
    /usr/local/bin/rake:23:in `<main>'
    Tasks: TOP => redmine:email:receive_imap

I look in the imap.rb on line 30, and see no issues, since that's where IMAP.new is called, and all of the arguments there are entered or have a default value

Is there a way to get closer to figuring out the specifics of the problem?

I have checked, and the username/password for the mail server is correct, as is the port/ip

Replies (3)

RE: Fetch email stopped working - Added by Djordjije Crni about 4 years ago

Looks like you are missing some IMAP parameter.
You can see the list of all available parameters:
RedmineReceivingEmails

port=PORT                IMAP server port (default: 143)
ssl=SSL                  Use SSL? (default: false)
starttls=STARTTLS        Use STARTTLS? (default: false)

If IMAP over SSL/TLS is used, then probably you have to configure port=993 (default IMAPs port) and ssl=SSL.
If IMAP STARTTLS is used, then probably you have to configure port=143 (default) and starttls=STARTTLS.

RE: Fetch email stopped working - Added by John Simmons about 4 years ago

We are using SSL, so I used this configuration

/usr/local/bin/rake -s -f /opt/redmine/current/Rakefile --trace redmine:email:receive_imap RAILS_ENV="production" host=mail.mycompany.com username= password=myPassword unknown_user=accept ssl=true port=993

I also tried with ssl=1, since I wasn't sure which values it really wants. I've seen examples of both.

With that, I get this error.

  • Invoke redmine:email:receive_imap (first_time)
  • Invoke environment (first_time)
  • Execute environment
  • Execute redmine:email:receive_imap
    rake aborted!
    OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=unknown state
    /usr/lib/ruby/2.0.0/net/imap.rb:1454:in `connect'
    /usr/lib/ruby/2.0.0/net/imap.rb:1454:in `start_tls_session'
    /usr/lib/ruby/2.0.0/net/imap.rb:1047:in `initialize'
    /opt/redmine/current/lib/redmine/imap.rb:30:in `new'
    /opt/redmine/current/lib/redmine/imap.rb:30:in `check'
    /opt/redmine/current/lib/tasks/email.rake:116:in `block (4 levels) in <top (required)>'
    /opt/redmine/current/app/models/mailer.rb:432:in `with_synched_deliveries'
    /opt/redmine/current/lib/tasks/email.rake:115:in `block (3 levels) in <top (required)>'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
    /usr/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
    /var/lib/gems/2.0.0/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
    /usr/local/bin/rake:23:in `load'
    /usr/local/bin/rake:23:in `<main>'
    Tasks: TOP => redmine:email:receive_imap

RE: Fetch email stopped working - Added by Djordjije Crni about 4 years ago

Which version of OpenSSL is used on your Redmine server?

Try to connect to IMAP host using OpenSSL command:

openssl s_client -crlf -connect mail.mycompany.com:993
and examine output of command: server certificate, certificate chain, supported TLS/SSL protocol versions, and cipher.
If everything is working OK, you can issue several standard IMAP commands, e.g.:
a1 LOGIN redmine@mycompany.com MyPassword
a2 LIST "" "*" 
a3 EXAMINE INBOX
a4 FETCH 1 BODY[]
a5 LOGOUT

(1-3/3)