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

32
LINES

< > BotCompany Repo | #1005141 // GMail: Show last mails in inbox

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

Uses 4463K of libraries. Click here for Pure Java version (6197L/42K/150K).

!7

static int numMsgs = 20;

p {
  veryBigConsole();
  if (empty(gmailDefaultUser())) {
    print("Run #1005140 to set gmail user name!");
    ret;
  }
  
  Folder inbox = gmail_inbox();
  printLastMails(inbox);
}

svoid printLastMails(Folder inbox) ctex {
  inbox.open(Folder.READ_ONLY);
  int count = inbox.getMessageCount();
  for (int i = count; i >= max(1, 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  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005141
Snippet name: GMail: Show last mails in inbox
Eternal ID of this version: #1005141/15
Text MD5: 30dd274177acb0c8fb9d0aaabe5b99e5
Transpilation MD5: 515456076755c0308d1ec26babe668a1
Author: stefan
Category: javax / gmail
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-12-14 18:12:06
Source code size: 989 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 641 / 902
Version history: 14 change(s)
Referenced in: #1010556 - Test reading web.de emails [OK]