Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

28
LINES

< > TinyBrain | #1005141 - GMail: Show last mails in inbox

JavaX source code [tags: use-pretranspiled] - run with: x30.jar - homepage

Uses 590K of libraries. Click here for Pure Java version (2452L/17K/62K).

!7

static int numMsgs = 10;

p {
  veryBigConsole();
  if (empty(gmailDefaultUser())) {
    print("Run #1005140 to set gmail user name!");
    ret;
  }
  
  Folder inbox = gmail_inbox();
  inbox.open(Folder.READ_ONLY);
  int count = inbox.getMessageCount();
  for (int i = count; i >= max(0, count-numMsgs+1); i--) {
    print("\nLoading message " + i + "\n");
    Message msg = inbox.getMessage(i);
    print("  From: " + InternetAddress.toString(msg.getFrom()));
    print("  Subject: " + msg.getSubject());
    print("  Message number: " + msg.getMessageNumber());
    print("  Sent/Received: " + msg.getSentDate() + "/" + msg.getReceivedDate());
    //print("  Class: " + getClassName(msg));
    //O content = msg.getContent();
    //print("  Content type: " + getClassName(content));
    print("  Size: " + msg.getSize());
    print("  Content type: " + msg.getContentType());
  }
}

Author comment

Began life as a copy of #1003302

download  show line numbers  debug dex   

Travelled to 3 computer(s): cfunsshuasjs, ddnzoavkxhuk, tvejysmllsmz

No comments. add comment

Snippet ID: #1005141
Snippet name: GMail: Show last mails in inbox
Eternal ID of this version: #1005141/11
Text MD5: 4f2e6ed364875a7809fe0de702803d71
Transpilation MD5: a847747c35b628581ad9cc23d385a289
Author: stefan
Category: javax / gmail
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-14 00:18:07
Source code size: 915 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 90 / 125
Version history: 10 change(s)
Referenced in: [show]