No authentication mechanisms supported by both server and client when Configuring Microsoft Exchange SMTP Server
Symptoms
When trying to establish connection to your Microsoft Exchange SMTP server, an error returns.
The following appears in the atlassian-confluence.log
:
com.atlassian.mail.MailException: javax.mail.AuthenticationFailedException: No authentication mechansims supported by both server and client
at com.atlassian.mail.server.impl.SMTPMailServerImpl.send(SMTPMailServerImpl.java:193)
at com.atlassian.confluence.jmx.JmxSMTPMailServer.send(JmxSMTPMailServer.java:80)
at com.atlassian.confluence.admin.actions.mail.SendTestEmailAction.execute(SendTestEmailAction.java:53)
Caused by: javax.mail.AuthenticationFailedException: No authentication mechansims supported by both server and client
at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:760)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:673)
at javax.mail.Service.connect(Service.java:317)
at javax.mail.Service.connect(Service.java:176)
at javax.mail.Service.connect(Service.java:125)
at com.atlassian.mail.server.impl.SMTPMailServerImpl.send(SMTPMailServerImpl.java:164)
... 257 more
Oops! We misspelled 'mechanisms' in the error message in the logs.
Cause
Recent changes in the JavaMail API has changed certain authentication defaults and sometimes will create an authentication error with some Exchange Server environments dependent on the configuration.
Resolution 1
- Set
-Dmail.smtp.auth.ntlm.domain=<Domain_name>
and restart Confluence. - Enable TLS or SSL on the your exchange mail server for the specific mailbox.
- Use one of the following syntaxes for your user:
Domain_name\username
username@Domain_name.com
If this is not successful, try downgrading the mail jar:
Resolution 2
Make a backup of
"$Confluence_install/confluence/WEB-INF/lib/mail-1.4.5.jar"
and move it to another directory;If you're running Confluence EAR/WAR or has any mail server configured via JNDI, the
"mail-1.4.5.jar"
class will be on"$CATALINA_HOME/lib"
.- Download mail-1.4.1.jar
- Stop Confluence;
- Copy the
"mail-1.4.1.jar"
for"$Confluence_install/confluence/WEB-INF/lib/"
(or"$CATALINA_HOME/lib"
in case of a EAR/WAR Confluence deploy); - Start Confluence and check now if Confluence was able to connect in Exchange.
Resolution 3
- Remove the existing mail server configuration
- Create a new one leaving username and password empty
Restart the server
This will solve the problem when the authentication is not needed (usually for exchange servers)