how to synchronize application email to server email using java mail in android
- by Akash
i want to change synchronously change in email application then automatic change in server email. For example :- i have read the unread message on email application then automatic server email change unread mail to read mail.
my email application has use mail jar file, activation.jar and additional jar file use
and following code are use for connectivity email application to server email..
Properties props = System.getProperties();
props.setProperty("mail.store.protocol", "imaps");
props.put("mail.smtp.starttls.enable","true");
Authenticator auth = new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication(){
return new PasswordAuthentication("USEREMAILID","PASSWORD ");
}
};
sessioned= Session.getDefaultInstance(props, auth);
store = sessioned.getStore("imaps");
// store.connect("imap.next.mail.yahoo.com","[email protected]","123456789");
store.connect("smtp.gmail.com","USEREMAILID","PASSWORD ");
inbox = store.getFolder("inbox");
inbox.open(Folder.READ_ONLY);
FlagTerm ft = new FlagTerm(new Flags(Flags.Flag.SEEN), false);
UNReadmessages = inbox.search(ft);