Question

I'm trying to develop an Android application that takes a username and password from a user and checks his/her credentials against an email server. I just need to send the username and password combination to the email server and if the server accepts, then my application will consider the user to be authenticated.

I tried using Javamail, but apparently it doesn't get along with dalvik. Someone suggested that I try using Apache Commons, but I can't figure out how to get it to do what I need.

If anyone has any ideas, I greatly appreciate the help!

The server that I'm connecting to uses IMAP/SMTP, by the way.

Update: Here's the code that I'm using to do the connect

client = new AuthenticatingSMTPClient();
client.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out), true));
client.connect(HOST, PORT);
client.login();
client.execTLS();
client.auth(AuthenticatingSMTPClient.AUTH_METHOD.PLAIN,user,pword);

And the server reply is :

220 pod51000.outlook.com Microsoft ESMTP MAIL Service ready at Thu, 14 Feb 2013    18:52:33 +0000
HELO 10.71.12.99
250 pod51000.outlook.com Hello [66.76.192.214]
STARTTLS
220 2.0.0 SMTP server ready
AUTH PLAIN
503 5.5.2 Send hello first

I've never had to do anything like this before, so I just need a little direction on things like how to send "Hello", what else the server expects, etc.

Was it helpful?

Solution

Solved it! Added a client.helo() before authentication and it works beautifully

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top