[SOLVED] Imap mail to ticket suddenly stopped working (SSL certificate verify failed)
I'm on the latest Redmine 4.0.4 on my Ubuntu 18.04;
Ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]
Phusion Passenger 5.0.30
Since a couple of days I've always used to generate new Issues from email, fetching from several gsuite (gmail) accounts.
Here is a sample of one of my many crons:
/8 * * * * /usr/local/bin/rake -f /usr/share/redmine/Rakefile redmine:email:receive_imap RAILS_ENV="production" host=imap.gmail.com port=993 firstname.lastname@example.org password=my_password ssl=1 folder=issues_folder project=my_project priority=Normal tracker=MyTracker move_on_success=read move_on_failure=failed unknown_user=create default_group=default_group no_permission_check=1
It has been working since a couple of years but starting from Wednesday (probably) it stopped.
Here is the error I get with a --trace:
** 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 returned=1 errno=0 state=error: certificate verify failed (self signed certificate) /usr/lib/ruby/2.5.0/net/protocol.rb:44:in `connect_nonblock' /usr/lib/ruby/2.5.0/net/protocol.rb:44:in `ssl_socket_connect' /usr/lib/ruby/2.5.0/net/imap.rb:1531:in `start_tls_session' /usr/lib/ruby/2.5.0/net/imap.rb:1092:in `initialize' /usr/share/redmine-4.0.4/lib/redmine/imap.rb:30:in `new' /usr/share/redmine-4.0.4/lib/redmine/imap.rb:30:in `check' /usr/share/redmine-4.0.4/lib/tasks/email.rake:121:in `block (4 levels) in <top (required)>' /usr/share/redmine-4.0.4/app/models/mailer.rb:612:in `with_synched_deliveries' /usr/share/redmine-4.0.4/lib/tasks/email.rake:120:in `block (3 levels) in <top (required)>' /var/lib/gems/2.5.0/gems/rake-12.3.3/lib/rake/task.rb:273:in `block in execute' /var/lib/gems/2.5.0/gems/rake-12.3.3/lib/rake/task.rb:273:in `each' /var/lib/gems/2.5.0/gems/rake-12.3.3/lib/rake/task.rb:273:in `execute' /var/lib/gems/2.5.0/gems/rake-12.3.3/lib/rake/task.rb:214:in `block in invoke_with_call_chain' /usr/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize' /var/lib/gems/2.5.0/gems/rake-12.3.3/lib/rake/task.rb:194:in `invoke_with_call_chain' /var/lib/gems/2.5.0/gems/rake-12.3.3/lib/rake/task.rb:183:in `invoke' /var/lib/gems/2.5.0/gems/rake-12.3.3/lib/rake/application.rb:160:in `invoke_task' /var/lib/gems/2.5.0/gems/rake-12.3.3/lib/rake/application.rb:116:in `block (2 levels) in top_level' /var/lib/gems/2.5.0/gems/rake-12.3.3/lib/rake/application.rb:116:in `each' /var/lib/gems/2.5.0/gems/rake-12.3.3/lib/rake/application.rb:116:in `block in top_level' /var/lib/gems/2.5.0/gems/rake-12.3.3/lib/rake/application.rb:125:in `run_with_threads' /var/lib/gems/2.5.0/gems/rake-12.3.3/lib/rake/application.rb:110:in `top_level' /var/lib/gems/2.5.0/gems/rake-12.3.3/lib/rake/application.rb:83:in `block in run' /var/lib/gems/2.5.0/gems/rake-12.3.3/lib/rake/application.rb:186:in `standard_exception_handling' /var/lib/gems/2.5.0/gems/rake-12.3.3/lib/rake/application.rb:80:in `run' /var/lib/gems/2.5.0/gems/rake-12.3.3/exe/rake:27:in `<top (required)>' /usr/local/bin/rake:23:in `load' /usr/local/bin/rake:23:in `<main>' Tasks: TOP => redmine:email:receive_imap
I understand it's related to the SSL certificate but I can't really imagine why it says that it's a self signed certificate...
Can you give me any hint?
RE: Imap mail to ticket suddenly stopped working (SSL certificate verify failed) - Added by Francesco Moro almost 3 years ago
This seems to be a bug fixed in Ruby 2.6.3 and later.
For a fix see:
this is the patch you should apply to ruby if you cannot upgrade:
RE: [SOLVED] Imap mail to ticket suddenly stopped working (SSL certificate verify failed) - Added by Fabián Rodríguez 5 months ago
Thanks for sharing this.
IMAP fetching from GMail (GSuite free tier) suddenly stopped working last week and this worked for me (one line patch to imap.rb file at
I am using Redmine 4.0.7 stable under Debian 10 (Buster) as per https://wiki.debian.org/Redmine.