NS: SMTP. OAuth2. Difficult to troubleshoot "Failed to connect to email server" errors

ID:    D28019
Published:    21 September 2023
Updated:    20 May 2024

Defect Id


Originally Reported Against

SBM 12.1

Also Affects

SBM 12.1 Hotfix 1
SBM 12.1 Hotfix 2
SBM 12.1 Hotfix 3
SBM 12.1 Hotfix 4
SBM 12.1 Hotfix 5

Resolved In

SBM 12.2
SBM 12.2 Hotfix 1


When configuring SBM to talk to an SMTP server, there are often issues with setting up the mailbox and/or AppRegistration in O365.  When this happens it is hard to identify a reason why mail server throws AuthenticationFailedException.  

As an example, a snippet from NS.LOG when attempting to connect to SMTP server may look like this. Notice there is little information in the error message:

2023-09-15 18:30:25,982 ERROR [QuartzScheduler_Worker-34] [] [::] -- Failed to connect to email server.
javax.mail.AuthenticationFailedException: failed to connect
at javax.mail.Service.connect( ~[javax.mail-1.6.2.jar:1.6.2]
at javax.mail.Service.connect( ~[javax.mail-1.6.2.jar:1.6.2]
at javax.mail.Service.connect( ~[javax.mail-1.6.2.jar:1.6.2]
at ~[common-util-12.1.jar:?]
at com.serena.sbm.ns.service.MailSenderImpl.lambda$0( ~[notificationsrv-api-12.1.jar:?]
at java.util.HashMap.forEach( [?:1.8.0_342]
at com.serena.sbm.ns.service.MailSenderImpl.send( [notificationsrv-api-12.1.jar:?]
at com.serena.sbm.ns.service.EmailMessageStrategy.apply( [notificationsrv-api-12.1.jar:?]
at com.serena.sbm.ns.process.EmailMessageServiceImpl.processMessages( [notificationsrv-api-12.1.jar:?]
at com.serena.sbm.ns.process.MessageServiceImpl.process( [notificationsrv-api-12.1.jar:?]


We have added better logging to assist.

Find Answers

Type a question or describe what you are looking for below

My Recent Searches

Welcome kb sso

Additional Assistance

  • Submit a Case Online
  • FAQs