Sending Email in Android using JavaMail API without using the default/built-in app
I'm trying to make an email app for my android according to the above link so I created three classes, made a simple layout but i can't make it to work? When i start the app in the emulator and the layout comes up and i press send there are no response. I suspect that the problem lies within the "send". Any tips?
I've also added, in the manifest. uses-permission android:name="android.permission.INTERNET"
And made a simple layout... and everytime i press the send button it doesnt send and only prints out "buttonbutton"!
package gaia.feedback.com;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
public class GaiaFeedbackActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final Button send = (Button) this.findViewById(R.id.send);
send.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
try {
GmailSender sender = new GmailSender("username@gmail.com", "password");
sender.sendMail("This is Subject",
"This is Body",
"user@gmail.com",
"user@yahoo.com");
System.out.println("buttonbutton");
} catch (Exception e) {
Log.e("SendMail", e.getMessage(), e);
System.out.println("coolcool");
}
}
});
}
}