There is a problem with the receipt of letters from e-mail to Android.
public class pop3 { static String nike; static String mes; public static void Messages() throws Exception { Properties props = new Properties(); String host = "pop.yandex.ru"; String username = "romanzi777@yandex.ru"; String password = "cybercuba"; String provider = "pop3"; Session session = Session.getInstance(props, null); Store store = session.getStore(provider); store.connect(host, username, password); Folder inbox = store.getFolder("INBOX"); if (inbox == null) { Log.e("Mail", "No INBOX"); } inbox.open(Folder.READ_ONLY); Message[] messages = inbox.getMessages(); for (int i = 0; i < messages.length; i++) { Log.e("Mail", "Всего писем:" + messages.length); Log.e("Mail", "Message " + (i + 1)); nike = messages[i].getSubject().toString(); if (nike.contains("FlyNote:")) { nike = nike.substring(0, 7); mes = messages[i].getContent().toString(); } } inbox.close(false); store.close(); }
When processing this code, the application crashes.
pop3.Messages ();
In the console (on Android) everything works. On Android, the following comes to the log:
09-23 06:40: 23.145: E / AndroidRuntime (324): java.lang.NoClassDefFoundError: javax.mail.Session
At the line:
Session session = Session.getInstance(props, null);
What is the problem?