Defect #37688

Move to modern authentication(OAuth 2.0) from IMAP for receiving email in Redmine.

Added by Raja Govindan 14 days ago. Updated 3 days ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:


Target version:-
Resolution: Affected version:



Microsoft is going to disable IMAP authentication to read emails from Office365. I need to use modern authentication to read/receive emails.
Currently, I am using IMAP to receive email into Redmine.

-- part of script below---
bundle exec rake f Rakefile redmine:email:receive_imap

Could you please help me in providing script to use modern authentication instead of IMAP

-/Raja G

Related issues

Duplicated by Redmine - Defect #37705: Move to modern authentication(OAuth 2.0) from IMAP for re... Closed


#1 Updated by Pedro Mello 12 days ago

the same goes for gmail. they disabled basic authentication in last May.

#2 Updated by Marius BALTEANU 10 days ago

  • Duplicated by Defect #37705: Move to modern authentication(OAuth 2.0) from IMAP for receiving email in Redmine. added

#3 Updated by Ronald Glatz 8 days ago

I have a same issue.

#4 Updated by Gael Duret 8 days ago

Hello All,

Same issue on our side, we are fetching email from our office365 account with IMAP.
Any help will be welcome.


#5 Updated by Howard Brown 7 days ago

Same Here

Adding weight to this Query - Basic Auth is deprecated this weekend (ish - it's MS). Can re enable till end of year after that OP will have to be removed if not compliant.

Any idea as to whether this will be picked up or not?

#6 Updated by Jesper Grann Laursen 5 days ago

I have hotfixed lib/redmine/imap.rb with a fix to use xoauth2 when provided with a longer than 30 chars password.

require 'mail_xoauth2'

       if imap_options[:password].length > 30
           imap.authenticate('XOAUTH2', imap_options[:username], imap_options[:password])
           imap.login(imap_options[:username], imap_options[:password]) unless imap_options[:username].nil?

And then use the OAuth2 gem, to fetch a token from microsoft in cron script, which call 'rake redmine:email:receive_imap' with the token as password.
It's just a quick fix, but it works for now.

#7 Updated by Howard Brown 5 days ago

Hi Jesper

Firstly Thanks - This really helps.

Am I able to just swap out the library for a the new version (if so where do I get it) or do I need to do a full redmine update?

#8 Updated by Dennis Buehring 4 days ago


we just worked with RedmineUP to get OAuth with O365 working with the Helpdesk Plugin.
No advertisement, but we had the same issue as Howard and wanted this to be done before anything is cut off by MS.

The plugin uses MS Graph from what i can see btw, not imap with with oauth.

#9 Updated by Howard Brown 3 days ago


Upgraded Ruby to the latest version and installed the mail_xoauth gem

Built a quick script to get the Access token from MS and used the token as the password in rake task

All working successfully - Fantastic !

Also available in: Atom PDF