Send email problem, Client was not authenticated

Olafur Ingolfsson August 3, 2011

Hi all,

I have a problem sending email from JIRA to an SMTP mail server. JIRA is hosted on our site and everything seems to work ok except for sending email.

We have configured the Mail Server as detailed in http://confluence.atlassian.com/display/JIRA/Configuring+JIRA+to+Send+SMTP+Mail (not using JNDI). This is pretty straightforward and we have tested that the SMTP server is accessible using telnet on port 25. We can also send email from a simple .NET test application using the same SMTP host name, username and password so the SMTP server and the user account is correctly configured.

It looks as the password for the SMTP username is not stored correctly, it doesn't matter if I put in a bogus password or the correct password, the Test Connection button on the configuration page always states that the connection was successful. Nevertheless I always get an error when trying to send a Test email.

Is it possible that the password is not stored correctly in JIRA? If I leave the password field empty and hit the Test Connection button I get an error stating that a password must be specified. If the password field is not empty then the Test Connection button always states that the connection was successful, no matter if the password is correct or not.

JIRA was installed on a Windows 2008 R2 SBS server as a standalone version, using the Windows installer.

The error I get when sending test email is:

---------------------------------------------------------------------------------------------------------

An error has occurred with sending the test email:

com.atlassian.mail.MailException: javax.mail.MessagingException: Can't send command to SMTP host;

nested exception is:

java.net.SocketException: Connection reset by peer: socket write error

at com.atlassian.mail.server.impl.SMTPMailServerImpl.send(SMTPMailServerImpl.java:169)

at com.atlassian.jira.web.action.admin.mail.SendTestMail.doExecute(SendTestMail.java:93)

at webwork.action.ActionSupport.execute(ActionSupport.java:165)

.

.

.

Caused by: javax.mail.MessagingException: Can't send command to SMTP host;

nested exception is:

java.net.SocketException: Connection reset by peer: socket write error

at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1564)

at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1551)

at com.sun.mail.smtp.SMTPTransport.close(SMTPTransport.java:696)

at javax.mail.Transport.send0(Transport.java:191)

at javax.mail.Transport.send(Transport.java:118)

at alt.javax.mail.TransportImpl.send(TransportImpl.java:18)

at com.atlassian.mail.server.impl.SMTPMailServerImpl.send(SMTPMailServerImpl.java:155)

... 127 more

Caused by: java.net.SocketException: Connection reset by peer: socket write error

at java.net.SocketOutputStream.socketWrite0(Native Method)

at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)

at java.net.SocketOutputStream.write(SocketOutputStream.java:136)

at com.sun.mail.util.TraceOutputStream.write(TraceOutputStream.java:114)

at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)

at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)

at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1562)

... 133 more

DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]

DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]

DEBUG SMTP: useEhlo true, useAuth true

DEBUG SMTP: useEhlo true, useAuth true

DEBUG SMTP: trying to connect to host "xxx.xxx.xxx", port 25, isSSL false

220 xxx.xxx.xxx Microsoft ESMTP MAIL Service ready at Thu, 4 Aug 2011 14:06:04 +0000

DEBUG SMTP: connected to host "xxx.xxx.xxx", port: 25

EHLO abc

250-xxx.xxx.xxx Hello [192.168.1.2]

250-SIZE

250-PIPELINING

250-DSN

250-ENHANCEDSTATUSCODES

250-STARTTLS

250-X-ANONYMOUSTLS

250-AUTH NTLM

250-X-EXPS GSSAPI NTLM

250-8BITMIME

250-BINARYMIME

250-CHUNKING

250-XEXCH50

250-XRDST

250 XSHADOW

DEBUG SMTP: Found extension "SIZE", arg ""

DEBUG SMTP: Found extension "PIPELINING", arg ""

DEBUG SMTP: Found extension "DSN", arg ""

DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""

DEBUG SMTP: Found extension "STARTTLS", arg ""

DEBUG SMTP: Found extension "X-ANONYMOUSTLS", arg ""

DEBUG SMTP: Found extension "AUTH", arg "NTLM"

DEBUG SMTP: Found extension "X-EXPS", arg "GSSAPI NTLM"

DEBUG SMTP: Found extension "8BITMIME", arg ""

DEBUG SMTP: Found extension "BINARYMIME", arg ""

DEBUG SMTP: Found extension "CHUNKING", arg ""

DEBUG SMTP: Found extension "XEXCH50", arg ""

DEBUG SMTP: Found extension "XRDST", arg ""

DEBUG SMTP: Found extension "XSHADOW", arg ""

DEBUG SMTP: Attempt to authenticate

DEBUG SMTP: use8bit false

MAIL FROM:<abc@xxx.xxx.xxx>

530 5.7.1 Client was not authenticated

DEBUG SMTP: got response code 530, with response: 530 5.7.1 Client was not authenticated

RSET

DEBUG SMTP: exception reading response: java.net.SocketException: Connection reset

.

.

.

---------------------------------------------------------------------------------------------------------

Best regards,

Oli

3 answers

1 accepted

1 vote
Answer accepted
Olafur Ingolfsson August 7, 2011

Well, this problem was caused by Exchange Authentication, I had to allow Basic authentication without requireing TLS to allow JIRA to send email. I did also try to configure JIRA to use TLS but it didn't work for other reasons.

The solution was to clear the "Offer Basic authentication only after starting TLS" option in Exchange for the SMTP receive connector (EMC -> Server Configuration -> Hub Transport, right-click on server name in Receive Connectors and select Properties, select the Authentication tab and clear the "Offer Basic authentication only after starting TLS"). This should be ok in our configuration since the SMTP connector is not available from the outside network.

Radu Dumitriu
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 7, 2011

So, I was right (I just praise myself). Was the TLS checkbox ticked under JIRA? Was the protocol correctly set on SECURE_SMTP ? Looking back, I can see in your log:

DEBUG SMTP: trying to connect to host "xxx.xxx.xxx", port 25, isSSL false

However, I missed out this line (ashamed):

250-STARTTLS

Olafur Ingolfsson August 7, 2011

Yes Radu, you were right:).

If I enabled TLS on JIRA then I got another error (which I didn't try to solve) and I was using the SMTP, not the SECURE_SMTP protocol.

0 votes
Ken Johnston March 20, 2012

Not an answer, but wondering if this fixed you issue with the:

530 5.7.1 Client was not authenticated

DEBUG SMTP: got response code 530, with response: 530 5.7.1 Client was not authenticated

I am gettign the same error.

Thanks

Ken

0 votes
Radu Dumitriu
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 3, 2011

java.net.SocketException: Connection reset by peer: socket write error

Means that your server is closing the connection. I sincerely suspect that this is a configuration from the server side, not a problem with Atlassian sw.

Disable first the anti-spam filters on that M$ server, check again the clients allowed to connect, protocols... Just my 2 cents

Olafur Ingolfsson August 3, 2011

Is there a way to manually see/update the password for the SMTP user in JIRA configuration files? I would at least want to rule out the possibility that the password is not stored correctly. It is strange that when I load the SMTP server configuration page the password field is always empty.

Best regards and thanks for your help,

Oli

Olafur Ingolfsson August 3, 2011

I tried disabling Content Filtering but that didn't change anything. The JIRA server is running on the same machine as the Exchange Server and I am able to send emails using .NET clients and from web pages running on the same server so the configuration for clients and protocols etc. should be ok. If I use a wrong password in the .NET test client I get the same error message, i.e. "5.7.1. Client was not authenticated".

Best regards and thanks for your help,

Oli

Radu Dumitriu
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 3, 2011

I've seen that behavior in 2 cases only:

1. Auth was in the OS (jira had no user/ no password).

2. Spam filters were enabled, Exchange was refusing connections (do not ask me why)

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 3, 2011

Here is a script I've used many times to get the password... no one writes it down: http://pastebin.com/nEisZwKs

Suggest an answer

Log in or Sign up to answer