JSM Mail Handlers cannot be configured using Oauth 2.0 because IMAP (or POP) is disabled for the mail box

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

    

Summary

Configuring a Jira Service Management (JSM) Mail Handler for a Service Management project via the page Project Settings > Email Request fails with the error "We could not connect to your mail server" while using the authorize button  with the Oauth 2.0 authentication

Environment

Jira Service Management 4.10.0 and higher

Diagnosis

  • An Oauth 2.0 integration was configured in ⚙ > System > Oauth 2.0, with the same scopes as the ones mentioned in Integrating with Oauth 2.0, and the connection test was successful
  • When trying to configure a JSM Mail Handler via the page Project Settings > Email Request:
    • Either of the 2 following errors is thrown thrown when clicking the authorize button with the Oauth 2.0 authentication
      • Error 1

        We couldn't connect to your mail server
        'JIRA couldn't open the folder 'inbox' at outlook.office365.com. Check and make sure the folder name is correct and try again.'

      • Error 2

        We couldn't connect to your mail server
        Here's the error we received: OAuth token not defined for connection. OAuth Authorisation required.

    • Note that the same error is thrown thrown when clicking the update button with the basic authentication
    • The following errors are thrown in the logs 
      • Error thrown in the Jira application logs

        2021-11-10 14:50:57,000+0000 http-nio-8080-exec-16 ERROR testuser 890x5726803x3 ygh5pa XXX.XX.X.XXX
        /rest/servicedesk/1/servicedesk/VYRGLOGTB/incomingemail/oauth/validateandsaveflow/f6c632f6-82c3-43d8-a821-447e47a32948 [c.a.s.i.rest.emailchannel.EmailChannelResource]
        Failed to validate and save token: jep.mail.connection.verifier.missing.folder.error :
        'JIRA couldn't open the folder 'inbox' at outlook.office365.com. Check and make sure the folder name is correct and try again.'
      • Error thrown in the Jira incoming mail logs

        2021-11-10 14:51:00,802+0000 ERROR [] http-nio-8080-exec-12 testuser 891x5727070x4 ygh5pa XXX.XX.X.XXX/rest/servicedesk/1/servicedesk/admin/email/test Unable to connect to the server at outlook.office365.com due to the following exception:
        com.atlassian.jira.internal.mail.processor.errors.MailConnectionException: OAuth token not defined for connection. OAuth Authorisation required.
        at com.atlassian.jira.internal.mail.processor.feature.channel.connectionverifier.DefaultChannelConnectionVerifier.verifyConnectionDefinition(DefaultChannelConnectionVerifier.java:87) [?:?]
        at com.atlassian.jira.internal.mail.processor.feature.channel.connectionverifier.DefaultChannelConnectionVerifier.verifyConnectionDefinition(DefaultChannelConnectionVerifier.java:69) [?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [?:1.8.0_292]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [?:1.8.0_292]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [?:1.8.0_292]
        at java.lang.reflect.Method.invoke(Method.java:498) [?:1.8.0_292]
        
        
  • When trying to configure a Jira Mail Handler with the same mailbox time from the page ⚙ > System > Incoming Mail using the Oauth 2.0 authentication, the following happens:
    • Adding a Mail Server is possible, and the authorize button and the test connection button both give successful results, making it look like the mail server will work well in Jira:
    • However, after adding a Mail Handler linked to the Mail Server, we can see that the test of the mail handler fails with the following error, making the mail handler un-usable:

      javax.mail.MessagingException: * BYE Jakarta Mail Exception: java.net.SocketTimeoutException:
      Read timed out while connecting to host "outlook.office365.com" as user "null" via protocol "SECURE_IMAP",
      caused by: com.sun.mail.iap.ConnectionException: * BYE Jakarta Mail Exception:
      java.net.SocketTimeoutException: Read timed out


Cause

IMAP (or POP, depending on which protocol is used to configure the mail server in Jira) is disabled for the mailbox.

Solution


Last modified on Feb 6, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.