Outgoing mail not working on SMTP server configured to use OAuth 2.0 as authentication method
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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
Jira is unable to send notifications and test emails when Outgoing Mail (SMTP) server is configured to use OAuth 2.0 as authentication method
Environment
Jira 9.2 (JSM) and above that supports OAuth 2.0 method for authenticating to mail servers;
SMTP relay that doesn't support OAuth 2.0 authentication and yet it's enabled as authentication method in the Outgoing Mail server configuration
Diagnosis
Check SMTP Server settings, if you see 'Authentication method' set to OAuth 2.0 Server, then it means that your SMTP server has to actually support Oauth 2.0 configuration
In outgoing mail log, the following errors will be present on an attempt to send a test email
2022-07-07 11:14:08,562+0800 Sending mailitem com.atlassian.jira.mail.SubscriptionSingleRecepientMailQueueItem owner: 'username(username)' ERROR anonymous Mail Queue Service c.a.jira.mail.SubscriptionSingleRecepientMailQueueItem javax.mail.MessagingException: Got bad greeting from SMTP host: your SMTP server IP or hostname, port: your SMTP server port #, response: [EOF]
com.atlassian.mail.MailException: javax.mail.MessagingException: Got bad greeting from SMTP host: SMTP host: your SMTP server IP or hostname, port: your SMTP server port #, response: [EOF]
at com.atlassian.mail.server.impl.SMTPMailServerImpl.sendWithMessageId(SMTPMailServerImpl.java:224)
at com.atlassian.mail.queue.SingleMailQueueItem.send(SingleMailQueueItem.java:38)
at com.atlassian.jira.mail.SubscriptionSingleRecepientMailQueueItem.sendSearchRequestEmail(SubscriptionSingleRecepientMailQueueItem.java:139)
at com.atlassian.jira.mail.SubscriptionSingleRecepientMailQueueItem.send(SubscriptionSingleRecepientMailQueueItem.java:103)
at com.atlassian.mail.queue.MailQueueImpl.sendBufferUnderLock(MailQueueImpl.java:83)
at com.atlassian.mail.queue.MailQueueImpl.sendBuffer(MailQueueImpl.java:47)
at com.atlassian.jira.mail.JiraMailQueue.lambda$sendBuffer$0(JiraMailQueue.java:49)
at com.atlassian.jira.util.velocity.DefaultVelocityRequestContextFactory.runWithStaticBaseUrl(DefaultVelocityRequestContextFactory.java:110)
at com.atlassian.jira.util.DefaultBaseUrl.runWithStaticBaseUrl(DefaultBaseUrl.java:56)
at com.atlassian.jira.mail.JiraMailQueue.sendBuffer(JiraMailQueue.java:48)
at com.atlassian.jira.service.services.mail.MailQueueService.run(MailQueueService.java:21)
at com.atlassian.jira.service.JiraServiceContainerImpl.run(JiraServiceContainerImpl.java:68)
at com.atlassian.jira.service.ServiceRunner.runService(ServiceRunner.java:62)
at com.atlassian.jira.service.ServiceRunner.runServiceId(ServiceRunner.java:44)
at com.atlassian.jira.service.ServiceRunner.runJob(ServiceRunner.java:32)
at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:134)
at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:106)
at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:90)
at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.launchJob(CaesiumSchedulerService.java:435)
at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeLocalJob(CaesiumSchedulerService.java:402)
at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeQueuedJob(CaesiumSchedulerService.java:380)
at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeJob(SchedulerQueueWorker.java:66)
at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeNextJob(SchedulerQueueWorker.java:60)
at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.run(SchedulerQueueWorker.java:35)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: javax.mail.MessagingException: Got bad greeting from SMTP host: your SMTP server IP or hostname, port: your SMTP server port #, response: [EOF]
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2198)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:722)
at javax.mail.Service.connect(Service.java:364)
at javax.mail.Service.connect(Service.java:222)
at javax.mail.Service.connect(Service.java:243)
at com.atlassian.mail.server.impl.SMTPMailServerImpl.sendWithMessageId(SMTPMailServerImpl.java:196)
... 24 more
Cause
The cause here is very likely that the SMTP server that's being configured actually does not support OAuth 2.0 as authentication method.
Solution
If your mail server doesn't support OAuth 2.0, setting the authentication method to 'Basic' with or without the password should fix the issue.
Was this helpful?