Just tried to send an email through gmail servers by doing the following:
AuthenticatingSMTPClient client = new AuthenticatingSMTPClient();
client.connect("smtp.gmail.com", 587); client.login(); client.execTLS(); client.auth(AUTH_METHOD.PLAIN, username, password); ...
Unfortunality after execTLS() I get a MalformedServerReplyException. I looked at the SMTPSClient source code and found out that the reader/writer are wrong after execTLS() got called. The performSSLNegotiation() method sets input and output to the new input/output streams from SSLSocket, but the reader/writer are still pointing to the values set inside connectAction().
Possible fix for this issue:
public boolean execTLS() throws SSLException, IOException
_reader = new CRLFLineReader(new InputStreamReader(_input_, encoding));
_writer = new BufferedWriter(new OutputStreamWriter(_output_, encoding));