gmail app 504 server timeout
- by Hui
this is the part of code I use for getting info from gmail, it's working alright on my localhost, but somehow when i deploy it online, I got 504 gateway timeout error.
Did I missed something in my code?
can someone give some advices , thanks a lot
public class GetGmail {
static String last = null;
public static ArrayList run(String username, String password, String lastloggin)throws Exception {
ArrayList result = null;
System.out.println("Getting Gmail......");
last = lastloggin;
Properties props = System.getProperties();
props.setProperty("mail.store.protocol", "imaps");
try {
Session session = Session.getDefaultInstance(props, null);
Store store = session.getStore("imaps");
store.connect("imap.googlemail.com", username, password);
result = readMessage(store);
store.close();
} catch (NoSuchProviderException e) {
e.printStackTrace();
return null;
} catch (MessagingException e) {
e.printStackTrace();
return null;
}
return result;
}
}