tags:

views:

24

answers:

1

javax.activation cannot be resolved, why?

+1  A: 

It cannot be resolved because it is not included in the Android APIs.

If you are trying to send email in Android, the easiest way is to use an intent.

Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_EMAIL, "[email protected]");
sendIntent.putExtra(Intent.EXTRA_TEXT, "email text");
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
sendIntent.setType("message/rfc822");
startActivity(Intent.createChooser(sendIntent, "Email:"));

If your intention is to send email in the background or from a service, firstly you should examine your reasons for doing so, but if there is a legitimate need and it wouldn't violate a user's privacy, see the article Sending email without user interaction in Android. A relevant excerpt from the article is:

What we did is we implemented the EHLO, AUTH and STARTTLS commands in the commons net library, reusing some code snippets from javax.mail. The currently supported authentication mechanisms are ‘plain’ and ‘login’, but we are also planning to add support for digest-md5 authentication. The patched library is tested with Gmail and a few other mail servers too.

Brian