how to synchronize application email to server email using java mail in android
Posted
by
Akash
on Stack Overflow
See other posts from Stack Overflow
or by Akash
Published on 2012-03-31T05:23:54Z
Indexed on
2012/03/31
5:29 UTC
Read the original article
Hit count: 478
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);
© Stack Overflow or respective owner